| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:【1006】做过的兄弟们帮个忙看看怎么错了,先谢谢了哈!实在测试不出来哪里不对……In Reply To:【1006】做过的兄弟们帮个忙看看怎么错了,先谢谢了哈!实在测试不出来哪里不对…… Posted by:allanlyy at 2005-04-03 15:07:14 > #include <stdio.h>
> int main()
> {
> int p,e,i,d,sum,m,n;
> int days[500];
> m = 0;
> while( scanf("%d %d %d %d",&p,&e,&i,&d) )
> {
> if((p==e)&&(e==i)&&(i==d)&&(d==-1))
> break;
> else
> {
> for(sum = 366;;sum++)
> if( ((sum - p)%23 == 0)&&
> ((sum - e)%28 == 0)&&
> ((sum - i)%33 == 0) )
> break;
> days[m] = sum - d;
> ++m;
> }
> }
> for(n = 0;n < m;n++)
> printf("Case %d: the next triple peak occurs in %d days.\n",n+1,days[n]);
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator