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

求助:到底哪里错了..谢谢!

Posted by iverson at 2005-03-22 13:17:26 on Problem 1006
/***********************************
		acm1006:Biorhythms
		   by Chen Wei
		   2005.4
***********************************/

#include <iostream.h>

int main(){
	int p,e,i,d,n = 0;
	cin >>p >>e >> i >>d;
	while(1){
		n++;
		if( (p == -1) && (e == -1) && (i == -1) && (d == -1) ) return 0;
		if( (p == e) && (p == i) ){
			d = p + 21252 - d;  //23,28,33的最小公倍数
		}
		else {
			while(1){
				i += 33;
				if( (i - e) % 28 == 0) break;
			}
			while(1){
				i += 924;
				if( (i - p) % 23 == 0){
					if( i == d ) d += 21252;
					else d = i - d;
					break;
				}
			}
		}
		cout <<"Case " <<n <<": the next triple peak occurs in " <<d <<" days." <<endl;
	}
	return 0;
}


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