今天是水题集啊。。。。A. Police Recruitstime limit per test1
secondmemory limit per test256 megabytesinputstandard inputoutputstandard
outputThe police departmen...
分类:
其他好文 时间:
2014-05-05 21:50:56
阅读次数:
795
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets
so as the following conditions hold:
The product of all numbers in the first set is less ...
分类:
其他好文 时间:
2014-05-03 23:51:19
阅读次数:
621
本题思路:
1 利用string保存数据,把string分成两半
2 由小到大排序
3 有小到大逐个比较,有一个不符合条件就可以结束循环了...
分类:
其他好文 时间:
2014-05-03 23:45:34
阅读次数:
349
动漫节一游回来之后一直处于一种意识模糊的状态看到大家都陆陆续续地过了C心里还是有点着急(自己没思路啊囧)其实当时就在想该如何找到DFS中的一个环,然后再找到环路上最小的一个值把所有环路上最小的值加起来就是结果,后来看到有人在群里说是tarjan求强连通分量,我就愉(bei)快(shang)地去睡觉了...
分类:
其他好文 时间:
2014-05-03 23:32:57
阅读次数:
495
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.
Valera has written n correct solutions. For each correct solution, he knows it...
分类:
其他好文 时间:
2014-05-03 16:53:51
阅读次数:
364
题目描述:
Description
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him...
分类:
其他好文 时间:
2014-05-03 16:45:31
阅读次数:
234
本题有意思,是hash表的灵活运用。
思路:
1 计算好总字符数,和使用hash表A[26]记录好各个字符出现的次数
2 判断总字符是否可以被k整除,如果不可以,那么就不能分成k个子字符了
3 计算各个字符出现的次数是否能被k整除,如果不能,那么就不能分成k个子字符
4 根据字符出现的次数逐个打印...
分类:
其他好文 时间:
2014-05-03 15:43:20
阅读次数:
394
Iahub accidentally discovered a secret lab. He
found there n devices ordered in a line, numbered from 1 to n from left to
right. Each device i (1?≤?i?...
分类:
其他好文 时间:
2014-05-02 15:36:19
阅读次数:
314
暴力法可过,效率O(n^2)
但是使用hash表可以把效率降到近乎O(n)
要巧妙使用两个map容器。
要对map和set容器很熟悉了,合起来一起使用。...
分类:
其他好文 时间:
2014-05-02 10:54:55
阅读次数:
365
本题因为数据量小,可以使用暴力法,时间效率是O(n^3)
但是这里巧用最大子段和的思想,可以把时间效率降到O(n)
思想:
1 想使用一个新的数列,计算连续出现了多少个1和连续出现了多少个零
2 求这个新数列的最大子段和
3 Flip最大子段中的 0 和 1,
4 计算出结果
比暴力法复杂很多了,但是时间效率却提高了三个档次。...
分类:
其他好文 时间:
2014-05-02 10:39:46
阅读次数:
584