B. Alice, Bob, Two Teams time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Alice and Bob are playing a game. The game involves splitting up game pieces into two teams. There are n pieces,…
B. Alice, Bob, Two Teams 题目连接: http://www.codeforces.com/contest/632/problem/B Description Alice and Bob are playing a game. The game involves splitting up game pieces into two teams. There are n pieces, and the i-th piece has a strength pi. The way…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 考虑任意两个字符串(a,b) 假设a在b的前面 那么如果a+b>=b+a 这里的+表示字符串的链接 那么显然需要交换a,b的位置. 这样能让最后结果的字符串的字典序更小一点. 把这个条件写在SORT的CMP函数里面 调用一下之后把n个字符串都拼起来就OK了 [代码] #include <bits/stdc++.h> using namespace std; const int N = 5e4; int n; string…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 写个前缀和 和 一个后缀和. (即前i个字符A所代表的数字的和以及前i个字符B所代表的数字的和.. 然后枚举前i个字符翻转. 求B对应数字的最大值 枚举i..n这些字符翻转 求B对应数字的最大值 两个同时求最大值就是答案了. [代码] #include <bits/stdc++.h> #define ll long long using namespace std; const int N = 5e5; int a[N+10]…
E - Alice, Bob, Oranges and Apples CodeForces - 586E 自己想的时候模拟了一下各个结果 感觉是不是会跟橘子苹果之间的比例有什么关系 搜题解的时候发现了 Stern-Brocot tree 长这样 和我想的那个很类似 可开心了 但是后来看不懂题解什么意思 关于Stern树的一点结论是 每一层相邻的两个数a/b 和 c/d 可以得到下面一层的数(a+c)/(b+d) 而且分子分母一定是互质的 后来自己找规律 觉得如果x比y小就需要一次B操作 下面是代…
C. Alice, Bob and Chocolate 题目连接: http://codeforces.com/contest/6/problem/C Description Alice and Bob like games. And now they are ready to start a new game. They have placed n chocolate bars in a line. Alice starts to eat chocolate bars one by one f…
CF6C Alice, Bob and Chocolate 题目链接 写了一天搜索写的有点累了,就顺手水了一道CF的模拟题 这道题就是简单的模拟整个题的过程,注意最后输出的形式就好了QWQ AC代码如下: #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #define MAXN 500000 using namesp…
[CodeForces 1249A --- Yet Another Dividing into Teams] Description You are a coach of a group consisting of n students. The i-th student has programming skill ai. All students have distinct programming skills. You want to divide them into teams in su…
There is No Alternative 题目连接: http://codeforces.com/gym/100803/attachments Description ICPC (Isles of Coral Park City) consist of several beautiful islands. The citizens requested construction of bridges between islands to resolve inconveniences of u…
E. Holes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/13/problem/E Description Little Petya likes to play a lot. Most of all he likes to play a game «Holes». This is a game for one person with following rules: There are…