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 2004huangyimin at 2005-05-07 20:10:28 on Problem 1006
#include<iostream>
using namespace std;
int initialin(int in){return in%33;}
int initialem(int em){return em%28;}
int initialph(int ph){return ph%23;}
int peak (int a,int b,int c)
{
	int x,y,z,i;
	for(i=23;;i++)
	{
		x=i%23;
		y=i%28;
		z=i%33;
		if(x==a&&y==b&&z==c)
		{return i;}
	}
}
void main()
{
	int a,b,c,p,e,i,d,g,num(0);
	while(1)
	{
		cin>>p>>e>>i>>d;
		if(p==e&&e==i&&e==d&&d==-1)
		{break;}
		a=initialph(p);
		b=initialem(e);
		c=initialin(i);
		g=peak(a,b,c);
		cout<<"Case "<<++num<<": the next triple peak occurs in ";
		cout<<g-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