| ||||||||||
| 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..求测试数据把我的程序干掉或其他解释已经把题目中的数据和论坛里的测试数据都试过了,还是WA,只好希望高手给予解释了……
#include<iostream>
using namespace std;
int main(){
int a1,a2,a3,d,i,days;
i=1;
while(1)
{
cin >> a1 >> a2 >> a3 >> d;
if(a1 == -1)break;
do{
if(a1 <= a2 && a1 <= a3)a1 += 23;
else if(a2 <= a1 && a2 <= a3)a2 += 28;
else a3 += 33;
}while(a1 != a2 || a2 != a3);
days = a1 - d;
if(days > 21252) days=days-21252;
cout << "Case " << i << ": the next triple peak occurs in " << days << " days." << endl;
i++;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator