-
455. Sequence analysis 比赛的时候逗了,往看空间限制了.... 直接开了个set判重。。。显然MLE 了。。。 然后这道题的正解是 floyd判圈算法(也叫龟兔算法?) http://www.cnblogs.com/oyking/p/4286916.html 这份题解讲得很详细 1 /************************************************************************* 2> File Name: code/2015summer/#5/CC.cpp 3> Author: 111qqz 4> Email: rkz2013@126.com …
Read More -
简单模拟,n,m貌似给反了(两个地方给的不一致 ) 害我wa了两发 1 2 /************************************************************************* 3> File Name: code/2015summer/#5/K.cpp 4> Author: 111qqz 5> Email: rkz2013@126.com 6> Created Time: 2015年07月30日 星期四 14时00分56 …
Read More -
SGU 456 Annuity Payment Scheme
Jul 30, 2015 · 1 min read水题,推个公式出来,注意精度...一遍A 1 2 /************************************************************************* 3> File Name: code/2015summer/#5/D.cpp 4> Author: 111qqz 5> Email: rkz2013@126.com 6> Created Time: 2015年07月30日 星期四 13时17分26秒 7************************************************************************/ 8 9 …
Read More -
SPOJ AMR10F Cookies Piles
Jul 29, 2015 · 1 min readAMR10F - Cookies Piles 水. 1 2 3 /************************************************************************* 4> File Name: code/2015summer/#4/F.cpp 5> Author: 111qqz 6> Email: rkz2013@126.com 7> Created Time: 2015年07月29日 星期三 21时47分23秒 8************************************************************************/ …
Read More -
Sliding Window 看这个问题:An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves rightwards by one position.Your task is to determine the maximum and …
Read More -
快要炸了.. tle成狗 因为是tle,看了下自己没有写cin cout,估计就是算法的问题... 我是先存了二进制的每一位到数组,然后扫一遍... 嗯,这都tle... 那我不存不扫,直接记录当前二进制位和之前二进制位.. logn的复杂度总可以了吧啊? 还TLE.......... 嗯,其实已经发现 n是小于等于1e18的,没开long long 但是一位没开long long 会是wa...就没理... 之后实在黔驴技穷,改了下,竟然过了... 然后想明白了. 因为存二进制的时候有一个while 没开long long 的话就炸了,不知道读进去的是什么,while就出不来,于是就tle了.T T 果然太年轻. 1 2 3 4 …
Read More -
C. Artem and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For …
Read More -
B. Andrey and Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one …
Read More -
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. Then Borya came and said that the …
Read More -
比赛的时候没做出来.这道题需要用到的一个重要的性质是,任意一个自然数可以表示成至多三个三角形数(1,3,6,10,15.....)的和(orz高斯)然后也有推广到任意自然数可以表示成k个k角形数的和的结论(费马提出了猜想,柯西给了证明)然后官方题解说的比较好: **这个题看上去是一个贪心, 但是这个贪心显然是错的. 事实上这道题目很简单, 先判断1个是否可以, 然后判断2个是否可以. 之后找到最小的k (k 2)k(k2), 使得(m - k) mod 6 = 0(m−k)mod6=0即可.** 证明如下: 3n(n-1)+1 = 6(n(n-1)/2)+13n(n−1)+1=6(n∗(n−1)/2)+1, 注意 …
Read More