| ||||||||||
| 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<iostream.h>
int same(int a, int b, int c,int d)
{
int aa=0,bb=0,cc=0;
for(int i=1;aa<21252;i++)
{
aa=a+i*23;
for(int j=1;bb<21252;j++)
{
bb=b+j*28;
for(int k=1;cc<21252;k++)
{
cc=c+k*33;
if(aa==bb&&bb==cc) return(aa-d);
}
}
}
}
void main()
{
int t=0,m=1,a,b,c,d;
for(;;)
{
cin>>a>>b>>c>>d;
if(a==(-1) && b==(-1) && c==(-1) && d==(-1)) break;
cout<<"Case"<<m<<": the next triple peak occurs in "<<same(a,b,c,d)<<" days."<<endl;
m++;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator