09 2013 档案

摘要:Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以Tidy要随时向Derek汇报某一段连续的工兵营地一共有多少人,例如Derek问:“Tidy,马上汇报第3个营地到第10个营地共有多少人!”Tidy就要马上开始计算 阅读全文
posted @ 2013-09-09 18:05 同学少年 阅读(231) 评论(0) 推荐(0)
摘要:Problem DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is not known for all possible inputs.Consider the following algori 阅读全文
posted @ 2013-09-09 17:41 同学少年 阅读(254) 评论(0) 推荐(0)
摘要:Problem DescriptionGiven two integers n and m, count the number of pairs of integers (a,b) such that 0 #include using namespace std;int main(){ int N,n,m,Case,count; int Ni,a,b; cin>>N; for(Ni=0;Ni>n>>m&&(n||m))//这个条件要特别注意 { count=0; for(a=1;a>n>>m&&(n||m))里面. 阅读全文
posted @ 2013-09-09 17:22 同学少年 阅读(296) 评论(0) 推荐(0)
摘要:Problem DescriptionGardon的18岁生日就要到了,他当然很开心,可是他突然想到一个问题,是不是每个人从出生开始,到达18岁生日时所经过的天数都是一样的呢?似乎并不全都是这样,所以他想请你帮忙计算一下他和他的几个朋友从出生到达18岁生日所经过的总天数,让他好来比较一下。Input一个数T,后面T行每行有一个日期,格式是YYYY-MM-DD。如我的生日是1988-03-07。OutputSample Input11988-03-07Sample Output6574AuthorGardonSourceGardon-DYGG Contest 2解题思路:如下代码代码:#incl 阅读全文
posted @ 2013-09-01 13:34 同学少年 阅读(339) 评论(0) 推荐(0)
摘要:Problem DescriptionHOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完?请你写个程序帮忙计算一下。Input第一行有一个整数T,接下来T组数据,每组数据占2行,第一行是一个整数N(0using namespace std;int kind[1000005];int main(){ int t; //t组数据 int n; //n种类 cin>>t; int i,j; ... 阅读全文
posted @ 2013-09-01 13:14 同学少年 阅读(965) 评论(0) 推荐(0)
摘要:Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.OutputOutput the approximations of e generated by the above formula for the values of n from 0 to 9. The beginni 阅读全文
posted @ 2013-09-01 13:04 同学少年 阅读(202) 评论(0) 推荐(0)
摘要:Problem DescriptionThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The 阅读全文
posted @ 2013-09-01 12:55 同学少年 阅读(225) 评论(0) 推荐(0)
摘要:Problem DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n).InputThe input consists of multiple test cases. Each test case contains 3 integers A, B and n on a single line (1 using 阅读全文
posted @ 2013-09-01 12:48 同学少年 阅读(275) 评论(0) 推荐(0)
摘要:Problem DescriptionContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.This year, they decide to l 阅读全文
posted @ 2013-09-01 12:28 同学少年 阅读(149) 评论(0) 推荐(0)