题目链接:http://www.codeforces.com/problemset/problem/327/A题意:你现在有n张牌,这些派一面是0,另一面是1.编号从1到n,你需要翻转[i,j]区间的牌一次,使得看到的牌是1的数量最大.C++代码: #include <iostream> using namespace std; ; int n, a[maxn], sum[maxn]; int flip(int L, int R) { ]; - a1; //cout << &quo…
A. Football time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a…
题目链接:http://www.codeforces.com/problemset/problem/339/A题意:重新组合加法字符串,使得按照1,2,3的顺序进行排列.C++代码: #include <iostream> #include <string> using namespace std; ]; string s, ans = ""; int main() { cin >> s; int len = s.length(); ; i <…