| ||||||||||
| 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>
#include<stdlib.h>
int main()
{
int a[1000][5],i,num=0,n=0;//n为case的数目
int d1,d2,d3;
//存储信息
while(1)
{
scanf("%d%d%d%d",&a[n][0],&a[n][1],&a[n][2],&a[n][3]);
if(a[n][0]==-1)
break;
n++;
}
//从第一个case开始处理
for(i=0;i<n;i++)
{
num=0;
d1=a[i][0];
d2=a[i][1];
d3=a[i][2];
while(1)
{
if(d1==0&&d2==0&&d3==0)
{
if(num==0)
{
num++;
d1=(d1-1)%23;
d2=(d2-1)%28;
d3=(d3-1)%33;
continue;
}
a[i][4]=num-a[i][3];
break;
}
num++;
d1=(d1-1)%23;
d2=(d2-1)%28;
d3=(d3-1)%33;
}
}
for(i=0;i<n;i++)
printf("Case %d: the next triple peak occurs in %d days.\n",i+1,a[i][4]);
//for(i=0;i<n;i++)
// printf("%d %d %d %d\n",a[i][0],a[i][1],a[i][2],a[i][3]);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator