| ||||||||||
| 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 | |||||||||
AC,开心开心。提示天数不能为负。10 5 0 34 21252#include<stdio.h>
int main(int argc,char *argv[])
{
int i=0,a=0,b=0,c=0,d=0,q[10200]={0},n=0;
while(a!=-1&&b!=-1&&c!=-1&&d!=-1)
{
scanf("%d %d %d %d",&a,&b,&c,&d);
if(d>365)
return 0;
if(d<0&&d!=-1)
return 0;
for(i=0;i<21252;i++)
{
if(a%23==0&&b%28==0&&c%33==0)
break;
if(a==24&&b==29&&c==34)
break;
a++;b++;c++;
}
if(a==24&&b==29&&c==34||(b-a==5&&c-b==5))
{ if(d==0)
q[n]=1;
else
q[n]=21252-d+1;
n++;
}
else
{
q[n]=21252-i-d;n++;
}
}
for(i=0;i<n-1;i++)
{
if(q[i]<=0)
printf("Case %d: the next triple peak occurs in %d days.\n",i+1,q[i]+21252);
else
printf("Case %d: the next triple peak occurs in %d days.\n",i+1,q[i]);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator