| ||||||||||
| 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 | |||||||||
我晕!哪位大哥看一下!怎么可能?和过了的程序比较了 N 个结果都一样还不过!拜托看看吧!
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
int max(int a,int b,int c)
{int x=a;if(x<b)x=b;if(x<c)x=c;return x;}
void main(int argc, char* argv[])
{ int p,e,i,d,M,TT,sum,n=1;
scanf("%d%d%d%d",&p,&e,&i,&d);
sum=p+e+i;
while(sum!=-3)
{ M=max(p,e,i);
if(sum==0)TT=21252-d;
else
{
if(((e-p)==5)&&((i-e)==5))
{
if((p-23-d)>0 )
TT=p-23-d;
else
TT=21252+(p-23-d);
}
else
{
for(M;M<21252;M++)
if(((M-p)%23==0)&&((M-e)%28==0)&&((M-i)%33==0))
{
TT=M-d;
break;
}
if(M==21252)
TT=21252-d;
if(TT==0)
TT=21252;
}
}
cout<<"Case "<<n <<": the next triple peak occurs in "
<< TT
<<" days.\n";
scanf("%d%d%d%d",&p,&e,&i,&d);
sum=p+e+i;
n++;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator