Codeforces Round #119 (Div. 2)A. Cut Ribbon】的更多相关文章

A. Cut Ribbon time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the following two conditions: After…
Cut Ribbon time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the following two conditions: After the…
A. Cut Ribbon \(f(i)\)表示长为\(i\)的布条最多可以剪几段. B. Counting Rhombi \(O(wh)\)枚举中心计算 C. Permutations 将序列一映射成序列二的位置,找到第一个\(a_i>a_{i+1}\)位置,后面的元素都需要操作一次. D. AlgoRace 最多有60个点,那么任意两点最短距离的边数不超过60条,也就是说最多改变60次即可. E. Weak Memory 二分q,然后跑最短路,若当前点有志愿者,则距离更新为0. 那么每条边最…
题意:给你一棵树,让你切掉尽可能多的边,使得产生的所有连通块都有偶数个结点. 对于一棵子树,如果它有奇数个结点,你再从里面怎么抠掉偶数结点的连通块,它都不会变得合法.如果它本来就有偶数个结点,那么你怎么抠,都是合法的. 所以,我们只需要切断所有有偶数结点的子树的父边即可. 然后再判一遍最后是否仍是合法的. #include<cstdio> #include<cstring> using namespace std; int n; int e,first[100005],nex[20…
题目链接 Problem - C - Codeforces 题目 Example input 3 2 4 3 a* 4 1 3 a**a 6 3 20 **a*** output abb abba babbbbbbbbb 题意 n--字符串长度, k--每个星号最多代表k个b ,  x--第x小的字符串s的子串(可以是不连续子串) 每一个星号可以换成0~k个b,  需要求出第x小的字符串s的子串. 题解 a****a***a**(连续的星号指两个a或者边缘之间夹的星号, 可以为1) 从后面往前看…
今天老师(orz sansirowaltz)让我们做了很久之前的一场Codeforces Round #257 (Div. 1),这里给出A~C的题解,对应DIV2的C~E. A.Jzzhu and Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Jzzhu has a big rectangular cho…
Codeforces Round #456 (Div. 2) A. Tricky Alchemy 题目描述:要制作三种球:黄.绿.蓝,一个黄球需要两个黄色水晶,一个绿球需要一个黄色水晶和一个蓝色水晶,一个蓝球需要三个蓝色水晶,现有\(A\)个黄色水晶和\(B\)个蓝色水晶,要制作\(x\)个黄球,\(y\)个绿球和\(z\)个蓝球,还需要多少个水晶? solution \(max(0, x*2+y-A)+max(0, z*3+y-B)\) 时间复杂度:$ O(1) $ B. New Year's…
题目传送门 /* 构造:从大到小构造,每一次都把最后不是9的变为9,p - p MOD 10^k - 1,直到小于最小值. 另外,最多len-1次循环 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; typedef long long ll; ; const int INF = 0x3f3f3f3f; int…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…