• Codeforces 844F Anti-Palindromize 最小费用流

    时间:2024-04-16 08:32:08

    Anti-Palindromize想到网络流就差不多了, 拆拆点, 建建边。#include<bits/stdc++.h>#define LL long long#define fi first#define se second#define mk make_pair#define PL...

  • Codeforces 293B

    时间:2024-04-14 20:48:38

    Codeforces 293B原题题目描述:给出一个\(n \times m\)的网格, 给定一个整数\(k\),网格上的每个数都不超过\(k\),其中有的格子是\(0\),要求把这些格子变成\(1~k\)的其中一个数, 使得任一条从左上角到右下角的路径中的数字都不一样, 求方案数。solution...

  • codeforces csp复赛训练利器---初识

    时间:2024-04-12 16:51:30

    codeforces csp复赛训练利器---初识1.解决codeforces访问慢的问题网站https://www.codeforces.com打开极慢,换句话说,根本就打不开。摘自https://www.cnblogs.com/flashhu/p/9786085.html摘自https://bl...

  • 【Codeforces Round #446 (Div. 2) C】Pride

    时间:2024-04-11 14:37:20

    【链接】 我是链接,点我呀:) 【题意】在这里输入题意【题解】想一下,感觉最后的结果肯定是从某一段开始,这一段的gcd为1,然后向左和向右扩散的。则枚举那一段在哪个地方。我们设这一段中所有的数字都做了一次gcd.假设在i..j这一段。则求gcd的顺序是(i,i+1),(i+1,i+2)...(j...

  • Codeforces 892 C.Pride

    时间:2024-04-11 14:02:39

    C. Pridetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have an array a with length n, you c...

  • Codeforces Round #308 (Div. 2)

    时间:2024-04-09 13:01:52

    A. Vanya and TableVanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom t...

  • Educational Codeforces Round 44 (Rated for Div. 2)

    时间:2024-04-08 19:41:40

    题目链接:https://codeforces.com/contest/985’A.Chess Placing题意:给了一维的一个棋盘,共有n(n必为偶数)个格子。棋盘上是黑白相间的。现在棋盘上有n/2个棋子,让你全部移动到黑色格子或者白色格子,要求步数最少,并输出步数。题解:由于黑色或者白色都是固...

  • 【codeforces 768F】Barrels and boxes

    时间:2024-04-08 18:50:52

    【题目链接】:http://codeforces.com/problemset/problem/768/F【题意】 让你把f个food和w个wine装在若干个栈里面; 每个栈只能装food或者是wine; 且装wine和food的栈交替出现; 然后是随机等可能地分配方案; 问你wine的栈里面,wi...

  • 【codeforces 768F】 Barrels and boxes

    时间:2024-04-08 18:32:36

    http://codeforces.com/problemset/problem/768/F (题目链接)题意A,B两种物品可以装到栈中,每个栈只能存放一种物品,容量没有限制。现在讲所有栈排成一列,AB相间,问存B的栈长大于H的概率。Solution震惊!F竟是个大水题。。。枚举长度隔板法搞一搞就好...

  • codeforces 985C Liebig's Barrels(贪心)

    时间:2024-04-08 17:46:45

    题目题意:有n * k块木板,每个木桶由k木板组成,每个木桶的容量定义为它最短的那块木板的长度。任意两个木桶的容量v1,v2,满足|v1-v2| <= d。问n个木桶容量的最大的和为多少,或者说明不可能做出这样的n个木桶。思路:一道纯粹的贪心题,可以确定最小的数MIN,那莫其他区间的最小的数就...

  • Educational Codeforces Round 3 C. Load Balancing

    时间:2024-04-06 13:10:43

    C. Load Balancingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the school computer room the...

  • codeforces - 432D Prefixes and Suffixes (next数组)

    时间:2024-04-04 08:46:07

    http://codeforces.com/problemset/problem/432/D转自:https://blog.csdn.net/tc_to_top/article/details/38793973题意给出一个字符串,求有多少种长度的前缀和后缀相等,并且这种形式的子串在原字符串中出现的次...

  • [Codeforces 321D][2018HN省队集训D4T2] Ciel and Flipboard

    时间:2024-04-03 18:08:38

    [Codeforces 321D][2018HN省队集训D4T2] Ciel and Flipboard题意给定一个 \(n\times n\) 的矩阵 \(A\), (\(n\) 为奇数) , 每次可以选 \(A\) 的一个 \(\frac {n+1}2 \times \frac {n+1} 2\...

  • Codeforces 671A Recycling Bottles(贪心+思维)

    时间:2024-04-03 11:31:01

    题目链接:http://codeforces.com/problemset/problem/671/A题目大意:给你两个人的位置和一个箱子的位置,然后给出n个瓶子的位置,要求让至少一个人去捡瓶子放到箱子里面去,一次只能拿一个瓶子,求把全部瓶子捡完之后的距离总和最小。解题思路:开始有两个起点A,B。除...

  • Codeforces Round #279 (Div. 2) C. Hacking Cypher 前缀+后缀

    时间:2024-04-01 21:30:44

    C. Hacking Cyphertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarpus participates in a com...

  • A Creative Cutout CodeForces - 933D (计数)

    时间:2024-03-28 17:13:53

    大意:给定$n$个圆, 圆心均在原点, 第$k$个圆半径为$\sqrt{k}$定义一个点的美丽值为所有包含这个点的圆的编号和定义函数$f(n)$为只有$n$个圆时所有点的贡献,求$\sum_{k=1}^{n}{f(k)}$首先注意到每个圆上的点对答案的贡献是相同的可以得到圆$x^2+y^2=c$上单...

  • codeforces 558/C Amr and Chemistry(数论+位运算)

    时间:2024-03-27 12:11:17

    题目链接:http://codeforces.com/problemset/problem/558/C题意:把n个数变成相同所需要走的最小的步数易得到结论,两个奇数不同,一直×2不可能有重叠枚举每个数可能到得所有值,以及统计达到该值的时候已经走的步数最终答案就是1到up中num[i]最小的数Exam...

  • Problem A CodeForces 556A

    时间:2024-03-27 11:13:30

    DescriptionAndrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.Once he thoug...

  • Codeforces 699

    时间:2024-03-25 16:41:51

    Problem A Launch of Collider题目大意在x轴上有n个点,坐标均为偶数。每个点或向左移动或向右移动,每秒移动距离为1。使所有点同时开始移动,求最早有点相遇的时间或无解。解题分析对于每一个向右移动的点,找右边最近的一个向左的点。向左移动同理。正反扫两遍即可。参考程序 #incl...

  • 【Codeforces 115D】Unambiguous Arithmetic Expression

    时间:2024-03-22 20:30:05

    Codeforces 115 D题意:给一个没有括号的表达式,问有多少种添加括号的方法使得这是一个合法的表达式?输入可能有正负号、加减乘除、数字。思路1:这是不能过的\(naive\)的\(dp\)。考虑\(dp(l,r)\)表示从第\(l\)个字符到第\(r\)个字符有多少种添加括号的方法。转移的...