Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

大虾帮忙看看,wa怎么回事啊??

Posted by N2o at 2006-09-25 15:11:28 on Problem 1006
#include <iostream.h>

int p, e, i, d;
int s;

void main(){
	while(1){
		s++;
		cin >> p >> e >> i >> d;
		if( p == -1 )
			break;
		int k;
		for( k = p; ; k += 23 ){
			if( k - e > 0 && ( k - e ) % 28 == 0 )
				break;
		}
		
		int j;
		for( j = k; ; j += 23 * 28 ){
			if( j - k > 0 && ( j - i ) % 33 == 0 )
				break;
		}
		cout << "Case "<<s<<": the next triple peak occurs in "<<j-d<<" days." << endl;

	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator