| ||||||||||
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 |
取石子游戏超时怎么改# include <iostream> # include <cstdio> # include <cmath> using namespace std; int main() { int d,q; int a,b; while(scanf("%d%d",&a,&b)!=EOF) { q=0; d=0; if(a>b) { int i=a; a=b; b=i; } for(int i=0;;i++) { int c=i*(1+sqrt(5.0))/2; if(a==c) { q=i; d=1; break; } if(a==c+i) { q=i; d=2; break; } } if(d==2) { cout<<1<<endl; continue; } if(d==1) { if(b==a+q) { cout<<0<<endl; continue; } else { cout<<1<<endl; continue; } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator