| ||||||||||
| 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 | |||||||||
我的算法为什么不对?哪位高人指点,小妹感激不尽!!!#include<stdio.h>
int main()
{
int i,j,k;
int a[4];
for(i=0;;i++)
{
for(j=0;j<4;j++)
scanf("%d",&a[j]);
if(a[0]==-1&&a[1]==-1&&a[2]==-1&&a[3]==-1)
break;
if((a[0]<0||a[0]>365)||(a[1]<0||a[1]>365)||(a[2]<0||a[2]>365)||(a[3]<0||a[3]>365))
{ i--;
continue;
}
else
{
if(a[0]==0&&a[1]==0&&a[2]==0&&a[3]==0)
k=21252;
else
{
for(k=0;k<=21252;k++)
if((k+a[3]-a[0])%23==0&&(k+a[3]-a[1])%28==0&&(k+a[3]-a[2])%33==0)
break;
}
printf("Case %d: the next triple peak occurs in %d days.\n",i+1,k);
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator