给一个字符串,问这个字符串中是否26个字母都出现过(大小写只出现一个就算出现过) 开个布尔数组,扫一遍即可。 嘛,做两道水题放松下== 反正也是要清的。
先预处理出来比小于等于n的素数的个数和回文数的个数…
C. Replacement
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Daniel has a string s, consisting of lowercase English letters and period signs (characters ‘.’). Let’s define the operation of replacement as the following sequence of steps: find a substring “..” (two consecutive periods) in string s, of all occurrences of the substring let’s choose the first one, and replace this substring with string “.”. In other words, during the replacement operation, the first two consecutive periods are replaced by one. If string s contains no two consecutive periods, then nothing happens.
给一个有序序列,问对于没一个数,和它相差最少和最多的数的位置。
快要炸了..
tle成狗
因为是tle,看了下自己没有写cin cout,估计就是算法的问题…
B. Kolya and Tandem Repeat
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Kolya got string s for his birthday, the string consists of small English letters. He immediately added k more characters to the right of the string.
http://acm.hdu.edu.cn/showproblem.php?pid=5311 题意:问能否从一个给定的字符串中拿出三个不相交的字串(原串可以有剩余),组成字符串“anniversary” 思路:暴力。
http://poj.org/problem?id=3279
反转类问题.
有N*M个方格,每个上面有数字0或者1
操作一个方格,这个方格及其相邻的四个方格(有公共边)会改变状态(由0变1或者由1变0)
http://codeforces.com/contest/558/problem/C
题目大意是说,给定N个数,可以对任意数进行任意次两种操作,×2,和/2(整除)
http://codeforces.com/problemset/problem/548/B
比赛的时候不懂为什么就没做出来…. 其实很容易想到一个o(q*(n+m))的做法… 就是每次更新,要同时更新当前更新行的最大连续和….O(m)可以完成…然后在O(n)扫一遍,找到所有行中的最大值。 然后需要注意的是,在第一次更改之前就要把每个行的最大值处理出来l.. 然后cf机器真是够快,O(nmq)的1.2S过。。。。