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 |
a>=2*b要用long long,亲们!因为2*b可能超过int的范围,附AC代码#include <stdio.h> int main() { int a,b,t; while(scanf("%d%d",&a,&b)!=EOF) { if(a+b==0)break; if(a<b) a=a^b,b=a^b,a=a^b; t=0; while(a%b!=0) { if(a/b>=2)break; a=a-b; if(a<b) a=a^b,b=a^b,a=a^b; t=!t; } if(!t) printf("Stan wins\n"); else printf("Ollie wins\n"); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator