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 Liudonghua at 2009-04-29 22:30:18 on Problem 1006
#include<iostream>
#include<vector>
using namespace std;

int main(){
    vector<int> b(4,1),days;
	while(b[0]!=-1){
		for(int j=0;j<4;j++)			
			cin>>b[j];     		
	    int p=0,e=0,d=0;
	    for(int n=1;n<21252/33;n++){
		      p=b[0]+23*n;
		      e=b[1]+28*n;
		      d=b[2]+33*n;
		      if(p==e && p==d && p+b[3]<21252){
				   e=21252-b[3]-p;
				   days.push_back(e);
				   n=21252;
		       }
		}

	}
    
	for(unsigned int i=0;i<days.size();i++)
		cout<<"Case "<<i+1<<": the next triple peak occurs in "<<days[i]<<" days."<<"\n";
	return 1;
}

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