Palindrome Transformation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningless…
题目传送门 /* 贪心+构造:因为是对称的,可以全都左一半考虑,过程很简单,但是能想到就很难了 */ /************************************************ Author :Running_Time Created Time :2015-8-3 9:14:02 File Name :B.cpp *************************************************/ #include <cstdio> #include &…
题目传送门 /* 暴力:O (n^2) */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> using namespace std; ; const int INF = 0x3f3f3f3f; int main(void) //Codeforces Round #183 (Div. 2) A. Pythago…
数论: C. Alice and Bob time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as fo…
Codeforces Round #297 (Div. 2)C. Ilya and Sticks Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  Solved: 2xx 题目连接 http://codeforces.com/contest/525/problem/C Description In the evening, after the contest Ilya was bored, and he really felt like ma…
Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description You are given a sequence of positive integers x1, x2, ..., xn and two non-negative integers a and b. Your task is to transform a into b. To do that, you can per…
C. Sequence Transformation 题目链接:https://codeforces.com/contest/1059/problem/C 题意: 现在有1~n共n个数,然后执行下面操作: 1.求出余下数的gcd,然后将gcd加入答案队列: 2.从中任意删除一个数,如果余下数的个数大于0,回到步骤1. 问答案队列字典序最大是什么. 题解: 这明明是递归在做极其方便,我偏偏用for循环来搞,加各种判断... 首先对于1,2,3...n来说,我们每次删去一个数时,肯定首先删去的是奇数…
C. Palindrome Transformation     Nam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to make it be a palindrome by using 4 arro…
题目链接:http://codeforces.com/contest/347/problem/C 题意是给你一个数n,然后n个数,这些数互不相同.每次可以取两个数x和y,然后可以得到|x - y|这个数,要求不在这个数组中,然后添加进去,直到不能取为止,不能取的人输了.Alice先取,求谁最后能赢. 可以先列举几种情况,可以发现,一般情况取到最后剩下1~max这些数了.但是要是比如原来的数有3 12这两个数,那最后就会剩下3 6 9 12这4个数,由此可以看出这种情况下剩下的一定是原来数的gcd…
You've got array a[1], a[2], ..., a[n], consisting of n integers. Count the number of ways to split all the elements of the array into three contiguous parts so that the sum of elements in each part is the same. More formally, you need to find the nu…