码迷,mamicode.com
首页 > 其他好文 > 详细

luogu_1290 欧几里德的游戏

时间:2017-10-07 22:03:48      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:highlight   ace   namespace   ret   name   put   cpp   names   scan   

#include <cstdio>
#include <iostream>
using namespace std;
int t,n,m;

int getsg(int x,int y){
    if(x%y==0)return 1;
    if(x/y==1)return 1-getsg(y,x%y);
    else return 1;
}

int main(){
    scanf("%d",&t);
    while(t--){
        scanf("%d%d",&n,&m);
        if(n<m)swap(n,m);
        if(getsg(n,m))puts("Stan wins");
        else puts("Ollie wins");
    } 
    return 0;
}

  

luogu_1290 欧几里德的游戏

标签:highlight   ace   namespace   ret   name   put   cpp   names   scan   

原文地址:http://www.cnblogs.com/codetogether/p/7635859.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!