| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts  | Current Contest Past Contests Scheduled Contests Award Contest  | |||||||||
Re:我这个哪里错了In Reply To:我这个哪里错了 Posted by:71107418_ls at 2008-08-13 15:12:49 > #include <iostream>
> #include <fstream>
> using namespace std;
> 
> bool decide(int a,int b)
> {
> 	if(b==0)
> 		return 0;
> 	if(a>=2*b)
> 		return 1;
> 	return !decide(b,a-b);//这里改为else return !decide(b,a-b);
> }
> int main()
> {
> 	int a,b;
> 	ifstream cin ("test.txt");
> 	while(cin>>a>>b)
> 	{
> 		if(a==0&&b==0)
> 			break;
> 		if(a<b)
> 			swap(a,b);
> 		if(decide(a,b))
> 			cout<<"Stan wins"<<endl;
> 		else
> 			cout<<"Ollie wins"<<endl;
> 
> 	}
> 	return 0;
> }
> 谢谢
Followed by: Post your reply here:  | 
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator