| ||||||||||
| 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 | |||||||||
帮我看看我错在哪里了?5555555#include <iostream.h>
void main()
{
int p;
int e;
int i;
int n;
int days;
int temp_sum[21253];
int temp_p;
int temp_i;
int temp_e;
int sum;
static int j;
for(;;)
{
cin>>p>>e>>i>>days;
if(p != -1 && e != -1 && i != -1 && days != -1)
{
j++;
for(sum = i;sum <= 21252;sum = sum+33)
{
temp_p = (sum - p) % 23;
temp_e = (sum - e) % 28;
temp_i = (sum - i) % 33;
if(temp_p == 0 && temp_e == 0 && temp_i == 0 && sum != 0)
{
break;
}
}
temp_sum[j] = sum - days;
}
else
{
break;
}
}
for(n = 1;n < j+1;n++)
{
cout<<"Case "<<n<<": the next triple peak occurs in "<<temp_sum[n]<<" days."<<endl;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator