标签:amp bre 大于 cst include cpp can data- style
较大数减去较小数的随意倍数。结果不能小于0,将两个数随意一个数减到0的为胜者。
b<a<2*b, 仅仅能 -->(b,a-b) , 然后再进行前面的推断.
#include<cstdio> #include<algorithm> using namespace std; int main() { int a, b; while(scanf("%d%d", &a, &b)) { if(a==0&&b==0) break; if(a<b) swap(a,b); bool Stan = true; while(1) { if(b==0 ||a%b==0||a/b>=2) break; int t = a; a = b; b = t - a; Stan = !Stan; } if(Stan) printf("Stan wins\n"); else printf("Ollie wins\n"); } return 0; }
hdu1525 Euclid's Game , 基础博弈
标签:amp bre 大于 cst include cpp can data- style
原文地址:http://www.cnblogs.com/jhcelue/p/7072489.html