10 2013 档案
hdu-1234开门人和关门人
摘要:开门人和关门人Problem Description每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。现有一堆杂乱的机房签 到、签离记录,请根据记录找出当天开门和关门的人。Input测试输入的第一行给出记录的总天数N ( > 0 )。下面列出了N天的记录。 每天的记录在第一行给出记录的条目数M ( > 0 ),下面是M行,每行的格式为 证件号码 签到时间 签离时间 其中时间按“小时:分钟:秒钟”(各占2位)给出,证件号码是长度不超过15的字符串。Output对每一天的记录输出1行,即当天开门和关门人的证件号码,中间用1空格分隔。 注意:在裁判的标准测试输入中,所有记录保证
阅读全文
hdu-1715大菲波数
摘要:A - 大菲波数 Problem DescriptionFibonacci数列,定义如下: f(1)=f(2)=1 f(n)=f(n-1)+f(n-2) n>=3。 计算第n项Fibonacci数值。Input输入第一行为一个整数N,接下来N行为整数Pi(1Fibonacci数列 { 0 n=0Fib(n)={ 1 n=1 { Fib(n-1)+Fib(n-2)其他情况Fib(n)的前十项Fib(0)=0, Fib(1)=1, Fib(2)=1, Fib(3)=2, Fib(4)=3, Fib(5)=5, Fib(6)=8, Fib(7)=13 Fib(8)=21, Fib(9)=34,
阅读全文
hdu-2181哈密顿绕行世界问题(dfs)
摘要:哈密顿绕行世界问题Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 906Accepted Submission(s): 544 Problem Description一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市。Input前20行的第i行有3个数,表示与第i个城市相邻的3个城市.第20行以后每行有1个数m,m=1.m=0退出.Output输出从第m个城市出发经过每个城市
阅读全文
hdu-1262寻找素数对
摘要:寻找素数对Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6675Accepted Submission(s): 3315 Problem Description哥德巴赫猜想大家都知道一点吧.我们现在不是想证明这个结论,而是想在程序语言内部能够表示的数集中,任意取出一个偶数,来寻找两个素数,使得其和等于该偶数. 做好了这件实事,就能说明这个猜想是成立的. 由于可以有不同的素数对来表示同一个偶数,所以专门要求所寻找的素数对是两个值最相近的.In
阅读全文
hdu-美素数
摘要:美素数Description 小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题,今天,小明想考考你对素数的认识。 问题是这样的:一个十进制数,如果是素数,而且它的各位数字和也是素数,则称之为“美素数”,如29,本身是素数,而且2+9 = 11也是素数,所以它是美素数。 给定一个区间,你能计算出这个区间内有多少个美素数吗?Input第一行输入一个正整数T,表示总共有T组数据(T 2 #include 3 4 #define maxn 1000005 5 6 int prime[maxn], ans[maxn]; 7 8 void is_prime() ...
阅读全文
hdu-又见GCD
摘要:又见GCDDescription有三个正整数a,b,c(0 2 3 int gcd(int m, int n) 4 { 5 int t; 6 if (m < n) 7 { 8 t = m; 9 m = n;10 n = t;11 }12 while (m % n != 0)13 {14 t = m % n;15 m = n;16 n = t;17 }18 return n;19 }20 21 int main()22 {23 ...
阅读全文
codeforces-Jeff and Periods
摘要:Jeff and PeriodsDescriptionOne day Jeff got hold of an integer sequence a1, a2, ..., an of length n. The boy immediately decided to analyze the sequence. For that, he needs to find all values of x, for which these conditions hold:x occurs in sequence a.Consider all positions of numbers x in the sequ
阅读全文
codeforces-Domino
摘要:DominoDescriptionValera has got n domino pieces in a row. Each piece consists of two halves — the upper one and the lower one. Each of the halves contains a number from 1 to 6. Valera loves even integers very much, so he wants the sum of the numbers on the upper halves and the sum of the numbers on
阅读全文