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:[新手]天数已尽In Reply To:[新手]提交十多次了,还不成功,请大家指教!本机测试也都能成功。 Posted by:xiaoxiaodi at 2006-01-10 20:50:57 > #include<stdio.h> > #include<math.h> > void main() > { > int p,e,d,i,j=0,k=1,flag1=0,flag2=0,flag3=0,temp; > scanf("%d",&p); > scanf("%d",&e); > scanf("%d",&i); > scanf("%d",&d); > while(flag1==0) > { > if(flag3==0) > { > if((p<0)||(e<0)||(i<0)||(d<0)) return; > else > { > if((p>365)||(e>365)||(i>365)||(d>365)) return; > } > flag3++; > } > temp=j*33+i; > if((abs(temp-p)%23==0)&(abs(temp-e)%28==0)) > { > if((p==e)&(e==i)) > { > if(flag2==0) flag2++; > else > { > printf("Case %d: the next triple peak occurs in %d days.\n",k,temp-d); > k++; > p=e=i=0; > scanf("%d",&p); > scanf("%d",&e); > scanf("%d",&i); > scanf("%d",&d); > flag3=0; > temp=0; > flag2=0; > j=-1; > } > } > else > { > printf("Case %d: the next triple peak occurs in %d days.\n",k,temp-d); > k++; > scanf("%d",&p); > scanf("%d",&e); > scanf("%d",&i); > scanf("%d",&d); > flag3=0; > temp=0; > flag2=0; > j=-1; > } > } > j++; > } > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator