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 |
把这个问题想得越简单越好,加保护反而WAIn Reply To:救命啊!错了好多次了,实在不知道错在哪里。 Posted by:shangmin at 2005-08-26 18:17:36 > 我自己测了好多都是正确的,各位高手帮忙看看啊!先谢谢了。 > > #include<stdio.h> > int main() > { > int p,e,i,d,count; > count=1; > while(1) > { > scanf("%d%d%d%d",&p,&e,&i,&d); > if(p==-1) > break; > p=p%23; > e=e%28; > i=i%33; > while(1) > { > if(p<=e&&p<=i) > p=p+23; > else > if(e<=p&&e<=i) > e=e+28; > else > i=i+33; > if(p==e&&e==i&&p>d) > { > printf("Case %d: the next triple peak occurs in %d days.\n",count,p-d); > count++; > break; > } > } > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator