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

Re:我这个怎么是output limit exeed啊?这是我的程序.

Posted by liyao88818 at 2008-07-01 11:17:29 on Problem 1067
In Reply To:我这个怎么是output limit exeed啊?这是我的程序. Posted by:zxm984623 at 2006-03-19 14:28:54
> #include<iostream>
> using namespace std;
> 
> void comp(unsigned long a,unsigned long b,unsigned long& max,unsigned long &min)//判断大小,并装入max,min 
> {if(a<b){min=a;max=b;}
>  if(a>b){max=a;min=b;}
>  if(a==b){max=a;min=b;}
> }
> 
> 
> bool judge(unsigned long &max,unsigned long &min)              //判断能否胜出 
> {if(min==1&&max==2)return 0;
>  if(min==0||min==1||min==2)return 1;
>  if(max==(2*min-1))return 0;
>  return 1;
> }
> 
> int main()
> {
>     unsigned long a,b;
>     unsigned long max,min;
>     for(;;)
>            {cin>>a>>b;
>             if(a>1000000000||b>1000000000)break;
>             comp(a,b,max,min);
>             if(judge(max,min)==1) cout<<"1"<<endl;
>             if(judge(max,min)==0) cout<<"0"<<endl;
>            }
> }

上面的算法就有问题,
可以找几组简单的必败的数据试一下,比如
3,5
> 4,7
> 6,10
> 8,13


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