Note the difference!!!

来源:互联网 发布:json.parseobject用法 编辑:程序博客网 时间:2024/05/16 17:10
//header for algorithm#include<iostream>#include<vector>#include<list>#include<string>using namespace std;//========Correctbool canWin(int a, int b){if(b/a>1 || b==a) return true;return !canWin(b-a, a);}//=======>!!!!bool canWin(int a, int b){if(b>=a*2 || b==a) return true;return !canWin(b-a, a);}//========int main(){#ifndef ONLINE_JUDGEfreopen("data.txt", "r", stdin);#endifint a, b;while(scanf("%d%d", &a, &b)&& a && b){if(a > b) swap(a, b);bool stanWin=canWin(a, b);if(stanWin)printf("Stan wins/n");else printf("Ollie wins/n");}return 0;}
范围啊, 范围啊, 注意了
原创粉丝点击