03 2014 档案

摘要:题目描述: Integer in C++Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)SubmitStatistic Next ProblemProblem Description KIDx: I like Java much more than C++, because I can use BigInteger in Java. :)However, KIDx has to use C++ language to do a project...Li... 阅读全文
posted @ 2014-03-30 11:47 windysai 阅读(209) 评论(0) 推荐(0)
摘要:题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=342题目意思:判断一行字符串为以下四种的哪一种:A regular palindrome,A mirrored string,A mirrored palindrome 和is not a palindrome。A regular palindrome 就是我们见得最多的普通回文字符串,正读和反读是一样的;A mirrored string 就是根据以下的一套规则,将每个 阅读全文
posted @ 2014-03-29 19:19 windysai 阅读(233) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3617题目意思:给出一条长度为n的字符串S,目标是要构造一条字典序尽量小,长度为n的字符串T。构造的规则是,如果S的头部的字母 S的尾部的字母,那么将S的尾部的字母加入到T中,删除S的尾部的字母。 这个题目的关键是如何处理 S 的头部的字母(假设用 i 指示) = S的尾部的字母(j) 这种情况。此时需要比较 i+1 和 j-1 的位置的字母,如果相同,继续比较下去。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn =... 阅读全文
posted @ 2014-03-24 21:00 windysai 阅读(612) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/405/D题目意思:从 1 ~ 1000000 中选择 n 个数:x1,x2,...,xn,对 x1-1,x2-1,...xn-1 求和得s1。然后在1 ~ 1000000 中除已经选择过的n个数中选择一些数,假设为y1, y2,...ym,设s = 1000000,对s-y1,s-y2,...,s-ym求和,如果这个和与s1相等,则输出y1,y2,...,ym 可以这样想,由于集合X中:x1,x2,...,xn 是各不相同的,那么在S - X,设为Y(假定S是全集:1,2,...,n)对每个数xi(. 阅读全文
posted @ 2014-03-23 16:43 windysai 阅读(445) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/400/C题目意思:给出一个n行m列的矩阵,问经过 x 次clockwise,y 次 horizontal rotate 和z次counterclockwise 之后,原来在n行m列的矩阵的坐标去到哪个位置。 题目意思很容易看懂。易知,对于clockwise,counterclockwise的次数,mod 4 == 0 相当于没有改变!而对于 horizontal rotate,mod 2 == 0 也是没有改变的! 假设问的坐标是(i, j),那么经过一次clockwise的转变,坐标变为(j, n. 阅读全文
posted @ 2014-03-22 21:56 windysai 阅读(285) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/404/B题目意思:Valera 参加马拉松,马拉松的跑道是一个边长为a的正方形,要求Valera从起点(0,0)出发,每经过距离d就给他一杯drink。求出n个位置,即Valera每经过d距离的position。 一开始我是直接模拟的,每次算出一个position就记录离该边最末还剩多少距离,假设为k,然后更新初始已有的距离k,又开始加a的距离直到到达下一个点...代码复杂之余,还超时了。 比较好的作法是:既然要求position,那么这个position一定是经过 i*d(i = 1 ~ n) 的距 阅读全文
posted @ 2014-03-22 11:33 windysai 阅读(327) 评论(0) 推荐(0)
摘要:题目描述: Word CountingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)SubmitStatistic Next ProblemProblem DescriptionEach year on May the graduate students are busy writing thesis, and the graduation thesis needs thousands of words. It's not a simple ... 阅读全文
posted @ 2014-03-19 15:13 windysai 阅读(314) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/402/A题目意思:几经辛苦,终于体明题目噶意思了 = =,完全是考验一个人是否清醒的最简便方法- -! 给出4个数,分别为k,a,b和v。k:1个box最大可以分成的section;a:需要放置的nut的个数;b:divisor的数量 v:每个section的容量。有两个约束条件:(1)每个box的section数不能超过k个; (2)放置的nut的数量不能超过v个(即不能超过section的最大容量)。注意:x个divisor可以得到x + 1个section,每个section的容量为v个。 .. 阅读全文
posted @ 2014-03-18 15:24 windysai 阅读(391) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/402/B题目意思:给出n个数和公差k,问如何调整使得ai + 1 - ai = k。(1 ≤ i = 1!! 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 1000 + 10; 7 int a[maxn], rea[maxn][2]; // a:原始输入序列 rea:保存需要调整的数的调整大小 8 char ch[maxn]; 9 10 int main() 11... 阅读全文
posted @ 2014-03-18 14:49 windysai 阅读(268) 评论(0) 推荐(0)
摘要:题目链接:(这个是内网的网址) http://172.22.27.1/problem?pid=1013 Good SequenceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)SubmitStatistic Next ProblemProblem DescriptionA sequence contains n integers.A sequence p1, p2, p3...pnis a good sequence if it satisfies... 阅读全文
posted @ 2014-03-17 23:13 windysai 阅读(271) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/401/C题目意思:给出0和1的数目(分别为n和m个),问是否能构造一条同时满足连续两个0不能再一起和连续三个1不能在一起,并且长度为n+m的序列,不能输出-1。 首先需要知道什么时候不能构造出来。假设c0代表0的数目,c1表示1的数目。那么可以构造的条件是:c0-1 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 1e6 + 5; 7 int a[2*maxn]; 8 9 int main()10 {11 ... 阅读全文
posted @ 2014-03-15 23:22 windysai 阅读(350) 评论(0) 推荐(0)
摘要:题目描述: IP Checking Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)Problem DescriptionAn IP address is a 32 bit address formatted in the following way:a.b.c.dwhere a, b, c, d are integers each ranging from 0 to 255. Now you are given two IP... 阅读全文
posted @ 2014-03-04 23:02 windysai 阅读(197) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/262/B题目意思:给出 n 个数和恰好一共要做的操作总数k。通过对n个数进行k次操作,每次操作可以把a[i] 转化为 -a[i](当然也可以对同一个数进行 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 1e5 + 10; 8 int a[maxn]; 9 10 int main()11 {12 int n, k, i, ans, cnt;13 while (scanf(... 阅读全文
posted @ 2014-03-04 20:52 windysai 阅读(268) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1106 这个题目一开始以为是水题,就想着用来轻松轻松,谁知道改得我想吐!! 除了discuss 中的数据外,还加上这两组,一般就能过了:001568970056 5551235555789 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 1000 + 10; 7 char s[maxn], t[maxn]; 8 int a[maxn]; 9 10 int main()11 {12 ... 阅读全文
posted @ 2014-03-02 21:25 windysai 阅读(295) 评论(0) 推荐(0)