A. Flipping Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub got bored, so he invented a game to be played on paper. He writes n integers a1, a2, ..., an. Each of those integers c…
题目传送门 /* 贪心:暴力贪心水水 */ #include <cstdio> #include <algorithm> #include <cstring> using namespace std; ; const int INF = 0x3f3f3f3f; int a[MAXN]; int main(void) //Codeforces Round #191 (Div. 2) A. Flipping Game { int n; scanf ("%d&quo…
Flipping Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub got bored, so he invented a game to be played on paper. He writes n integers a1, a2, ..., an. Each of those integers can…
题目链接: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. Flipping Game     time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub got bored, so he invented a game to be played on paper. He writes n integers a1, a2, ..., an. Each of those intege…
在div 188中,幸运的达成了这学期的一个目标:CF1800+,所以这次可以打星去做div2,有点爽. A.Flipping Game 直接枚举 B. Hungry Sequence 由于素数的分布大概10个中有一个,所以直接筛法筛1e5个即可. C. Magic Five 删除串s中的某些字符,使得他整除5,并且跟删除顺序有关,现在问有k个串s连在一起组成一个新的串,问新的串有多少种删除方式. 我们可以先看每一个串,由于整除5的数的末尾只能为0或者5. 用样例二 13990作为说明. 考虑只…
状态压缩DP,算sum,本来是枚举的,结果TLE了.. #include <iostream> #include <cstring> #include <cstdio> #include <queue> #include <cstdlib> using namespace std; #define MOD 1000000007 ]; <<]; <<]; ]; int lowbit(int t) { return t&…
D. Block Tower time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After too much playing on paper, Iahub has switched to computer games. The game he plays is called "Block Towers". It is…
. Hungry Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead of money,…
题目链接:http://codeforces.com/problemset/problem/429/B 给你一个矩阵,一个人从(1, 1) ->(n, m),只能向下或者向右: 一个人从(n, 1) ->(1, m),只能向上或者向右.必须有一个相遇点, 相遇点的值不能被取到, 问两个人能得到的最大路径和是多少? dp[i][j]:表示从一个点出发的最大值:先预处理从(1,1) (1,m) (n,1) (n,m)四个点出发的4个dp最大值.然后枚举所有的点,但是这个点不能在边缘,考虑枚举点不够…