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 wqfcr at 2003-12-26 19:38:03 on Problem 1067
#include <iostream.h>
long n,m;
void deal(long a,long b)
{
	long s=a/8;
	int r=a%8;
	if(a==0&&b==0)
	         cout<<0<<endl;
	else if(a==b||a==0)
		cout<<1<<endl;
	else if(r==2||r==5||r==7)
		cout<<1<<endl;
	else if(r==0)
	{
		if(b==s*5+a)
			cout<<0<<endl;
		else
			cout<<1<<endl;
	}
	else
	{ 
		 switch(r)
		 {
		 case 1:
			 {
				 if(b==a+1+5*s)
					 cout<<0<<endl;
				 else
					 cout<<1<<endl;
			 }break;
		 case 3:
			 {
				 if(b==a+2+5*s)
					 cout<<0<<endl;
				 else
					 cout<<1<<endl;
			 }break;
		 case 4:
			 {
				 if(b==a+3+5*s)
					 cout<<0<<endl;
				 else
					 cout<<1<<endl;
			 }break;
		 case 6:
			 {
				 if(b==a+4+5*s)
					 cout<<0<<endl;
				 else
					 cout<<1<<endl;
			 }break;
		 default:break;
		 }
	}
}
void main()
{
	long temp;
	while(cin)
	{
		cin>>n>>m;
		if(n>m)
		{
			temp=m;
			m=n;
			n=temp;
		}
		deal(n,m);
	}
}
	 

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