| ||||||||||
| 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 | |||||||||
求助啊~为什么我的结果正确,但是总是WA?#include <iostream>
using std::cin ;
using std::cout ;
int main(){
int a[100][4] = {0} ;
int num = 0 ;
int days = 0 ;
int l = 0 ;
for (int i = 0 ; i<100 ; i++)
{
for(int j=0;j<4;j++)
{
cin >> a[i][j] ;
if (a[i][j] == -1)
{
num++ ;
}
}
if (num==4)
{
l = i ;
break ;
}
}
for(int m = 0 ; m < l ;m++)
{
for(int k = 1; k <= 21252 ;k++)
{
if ( (k-(23-(a[m][3]-a[m][0])))%23==0 && (k-(28-(a[m][3]-a[m][1])))%28==0 && (k-(33-(a[m][3]-a[m][2])))%33 == 0)
{
days = k ;
if (days > 23*28*33)
{
days -= 23*28*33 ;
}
cout << "Case "<< m+1 << ": the next triple peak occurs in "<<days<<" days." << "\n" ;
}
}
}
return 0 ;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator