【Codeforces 258D】 Count Good Substrings】的更多相关文章

[题目链接] http://codeforces.com/contest/451/problem/D [算法] 合并后的字符串一定是形如"ababa","babab",ab交替出现的字符串 那么,判断一段是否为回文,只需判断首尾字符是否相等即可 [代码] #include<bits/stdc++.h> using namespace std; ; int i; long long ans1,ans2; char s[MAXN]; ][]; int mai…
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=2000),问满足[数列长度是k && 数列中每一个元素arr[i]在1~n之间 && 数列中元素可以重复]的数列有多少个?结果对10^9+7取余 解题思路:dp[i][j]表示长度是j,最后一位是i的种数 if(kk%i==0) dp[kk][j+1]+=dp[i][j] #inc…
[POJ 2777] Count Color(线段树区间更新与查询) Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 40949   Accepted: 12366 Description Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here…
[题目链接]:http://codeforces.com/contest/514/problem/C [题意] 给你n个字符串; 然后给你m个询问;->m个字符串 对于每一个询问字符串 你需要在n个字符串里面找到和它的长度相同,且只有一个位置的字符不同的字符串; 或者告知这是不存在的; [题解] 字符串hash 因为只有3个字符 所以权值就为3^x; 找个大质数取模就好: 不够大就再大一点.. 然后对于每一位,尝试换成其他两个字母,看看存不存在; [Number Of WA] 3 [完整代码]…
[题目链接]:http://codeforces.com/contest/768/problem/E [题意] NIM游戏的变种; 要求每一堆石头一次拿了x个之后,下一次就不能一次拿x个了; 问你结果 [题解] 用二进制来表示哪些数字被用过; 然后写一个记忆化搜索; 从上到下获取1..60的sg函数 枚举用了哪个数字,然后总数减掉它,可以使用的数字的状态改变; 往下走就好; 一定要记住 sg函数的最小值是0 从1开始的话会wa.. [Number Of WA] 5 [完整代码] #include…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable. In total the table A…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the len…
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of n rows…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output There are some beautiful girls in Arpa's land as mentioned before. Once Arpa came up with an obvious problem: Given an array and a number x, coun…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one. GukiZ has strings a, b, and c. H…