题目链接:  http://codeforces.com/contest/335/problem/B 分析: 第一眼看上去串的长度为5*10^4, 冒似只能用O(n)的算法可解. 而这样的算法从来没见过...... 其实不然, 注意一个条件"如果有存在长度为100的回文子串则输出长度为100的,否则输出最长的", 可以发现: 一个长度大于100的回文串都可以变成长度为100的 如: 长度为101的只要删除中间的一个就变为长度为100的, 长度为102的删除中间两个也变为长度为100的.…
题目大意 额,写来写去,我还是直接说抽象之后的题目大意吧: 有一个 r*2 的矩形,两个人轮流的在矩形上面减去一个 1*1 的小正方形,要求在减的过程中,不能使矩形“断开”,也就是说,如果一个人减去了 (i, 1) 这个矩形,那么,(i-1, 2), (i+1, 2), (i, 2) 这三个小正方形不能再被减去了,因为一旦减去它们中的一个,整个矩形就会被“剪断” 现在给你一个 r 和 n (1 ≤ r ≤ 100, 0 ≤ n ≤ r),表示有一个 r*2 矩形,已经有了 n 个位置被减去了,再…
只有小写字母 那>=2600的直接找单字母串长度大于等于100的就可以了 <2600 的dp找最长回文串 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<vector> using namespace std; #define N 50010 char s[N]; ]…
题目链接: B. Problems for Round time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n problems prepared for the next Codeforces round. They are arranged in ascending order by their diffi…
https://codeforces.com/contest/1056/problem/B 题意:输入n,m    求((a*a)+(b*b))%m==0的(a,b)种数(1<=a,b<=n) (n<=1e9,m<=1000) 题解:由于a,b的数量级很大,而m的数量级很小,又因为求((a*a)+(b*b))%m==0,即求((a%m*a%m)+(b%m*b%m))%m==0满足要求的a,b对数,也就是求a%m,b%m的平方分别取模后相加为0或者m的a,b对数,由于此时问题只和a%…
http://codeforces.com/contest/1054/problem/D 题目大意:一个序列a1 a2...an,可以对若干个元素进行取反,使所得的新序列异或和为0的区间个数最多. 题目分析:首先易知每个位置的前缀异或和的值只有两种,因为对元素进行取反时,取偶数个元素异或和不变,奇数个元素就是原值取反.然后由于对一个位置取反,不会影响后面位置与这个位置的前缀异或和相同的位置个数(因为这个位置取反后,后面各个位置的前缀异或和也跟着改变),所以一个位置的改变只会影响与前面位置前缀和相…
题目链接 http://codeforces.com/contest/325/problem/B 第一遍写了暴搜,果断TLE 然后上了二分,结果120组数据只有第40组过不了,我就写了奇怪的东西.... #include<stdio.h> #include<string.h> #include<iostream> #include<math.h> #include<vector> using namespace std; long long n;…
B. Photo to Remember Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/522/problem/B Description One day n friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together…
二分查找题, 不知道用double的人,用LL果断错了... B. Stadium and Games time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Daniel is organizing a football tournament. He has come up with the following tournament…
昨天晚上实在是=_=困...(浪了一天)就没有去打Codeforces 中午醒来看看题,还不太难. A题:模拟(水题 3minAC) // by Sirius_Ren #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int a[6],sum=0,ans; bool cmp(int a,int b){return a>b;} int main() { for…