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

Wrong answer,请高手指点!

Posted by BillStone at 2004-10-21 10:29:11 on Problem 1006
//1006.cpp
#include <iostream.h>
#include <math.h>
#include <fstream.h>

void main(void){
	int p,e,i,d,init;
//	ifstream fin;
//	fin.open("in.txt");

	cin>>p>>e>>i>>d;

	for(int x=1;p != -1 ;x++){
		if(d >= i){
			init = d-(d-i)%33;
		}
		else{
			init = d+(i-d)%33;
		}
		if(init == d)
			init += 33;
		for(int n=init;n<=21252+d;n += 33){
			if((n-p)%23 == 0){
				if((n-e)%28 == 0){
					cout<<"Case "<<x<<": the next triple peak occurs in "<<n-d<<" days."<<endl;
					break;
				}
			}
			if((n+33) > 21252+d){
				cout<<"Case "<<x<<": the next triple peak occurs in "<<n-d<<" days."<<endl;
			}
		}
		cin>>p>>e>>i>>d;
	}

// 	fin.close();
	return;
}

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