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:哪位大牛帮小第看一下.错哪了.总是wa?In Reply To:哪位大牛帮小第看一下.错哪了.总是wa? Posted by:catoran at 2005-06-12 22:43:45 data - d 可能是负值(就算改了,你这样循环会超时) > #include<stdio.h> > void main(){ > int p,e,i,d; > int count,data; > > count=0; > > while(1){ > > scanf("%d%d%d%d",&p,&e,&i,&d); > count++; > > if(p==-1&&e==-1&&i==-1&&d==-1) break; > > else{ > > for(data=1;;data++){ > if((data+23-p%23)%23==0&&(data+28-e%28)%28==0&&(data+33-i%33)%33==0){ > printf("Case %d: the next triple peak occurs in %d days.\n",count,data-d); > break; > } > } > } > } > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator