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 jinsong1zhang at 2009-04-27 10:43:28 on Problem 1006
#include<iostream>
using namespace std;
int main()
{
	int count;
	int a,b,c,d;
	int ans[10000];
	int index=0;
	cin>>count;
	for(int m=0;m<count;m++)
	{
		index=0;
		cin>>a>>b>>c>>d;
		while(!((a==-1)&&(b==-1)&&(c==-1)&&(d==-1)))
		{
			int temp;
			if(c)
				temp=c;
			else
				temp=33;
			bool flag=true;
			while(flag)
			{
				if(((temp-a)%23==0)&&((temp-b)%28==0))
					flag=false;
				else
					temp+=33;
			}
			if((temp-d>0)&&(temp-d)<=21252)
				ans[index++]=temp-d;
			else if(temp-d<=0)
				ans[index++]=temp-d+21252;
			else
				ans[index++]=temp-d-21252;
			cin>>a>>b>>c>>d;
		}
		for(int i=0;i<index;i++)
			cout<<"Case "<<(i+1)<<": the next triple peak occurs in "<<ans[i]<<" 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