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 kimhmguen at 2010-03-19 17:35:05 on Problem 1067
In Reply To:绝对科学的算法,不过lte了,可能题的意思是要保留计算结果?? Posted by:tankadozmy at 2010-02-05 17:33:34
> #include<iostream>
> #include<cstdlib>
> using namespace std;
> int judge(int,int);
> int min(int,int);
> int main()
> {
> 	int a,b;
> 	while(cin>>a>>b)
> 	{
> 		   cout<<judge(a,b)<<endl;
> 	}
> 	return 0;
> }
> int judge(int n,int m)
> {
> 	int i;
> 	if(n!=0&&m==0) return 1;
> 	if(n==0&&m!=0) return 1;
> 	if(n==0&&m==0) return 0;
> 	if(n==1&&m==0) return 1;
> 
> 	for(i=1;i<=n;i++)
> 	{
> 		if(judge(n-i,m)==0)
> 		return 1;
> 	}
> 	for(i=1;i<=m;i++)
> 	{	if(judge(n,m-i)==0)
> 	    return 1;
> 	}
> 	for(i=1;i<=min(n,m);i++)
> 	{	if(judge(n-i,m-i)==0)
> 		return 1;
> 	}
> 	
> 	return 0;
> }
> int min(int n,int m)
> {
> 	if(n<m) {return n;}
> 	return 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