| ||||||||||
| 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 | |||||||||
求助,老是Wrong Answer下面是小弟1006的代码,基本思想是利用循环累积计算体力周期高峰下一次出现的时间,对智力和感情周期天数取模,判断是否整除,若是,则输出。感觉没什么问题啊,也请救了好多同学,可就是WrongAnswer,大家帮帮忙啦。
#include<iostream>
using namespace std;
int main()
{
int k=0;
int input[100][4];
int i;
for(i=0;i<100;i++){
scanf("%d%d%d%d",&input[i][0],&input[i][1],&input[i][2],&input[i][3]);
if(input[i][0]==-1&&input[i][1]==-1&&input[i][2]==-1&&input[i][3]==-1)
break;
k++;
}
for(i=0;i<k;i++){
for(int j=1;;j++){
int sum=23*j;
int temp=sum+input[i][0];
if((temp-input[i][1])%28==0&&(temp-input[i][2])%33==0){
int result=temp-input[i][3];
//Case 1: the next triple peak occurs in 21252 days.
printf("Case %d: the next triple peak occurs in %d days.",i+1,result);
if(i<k-1) printf("\n");
else printf(" ");
break;
}
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator