hdu-1846 Brave Game

来源:互联网 发布:二叉树的遍历算法例题 编辑:程序博客网 时间:2024/05/29 02:24

http://acm.hdu.edu.cn/showproblem.php?pid=1846

//简单巴什博弈,如果n%(m+1)==0 则second赢,否则first赢。#include<cstdio>int main(){    int c,n,m;    scanf("%d",&c);    while(c--)    {        scanf("%d%d",&n,&m);        if(n%(m+1)) printf("first\n");        else printf("second\n");    }    return 0;}


 

0 0
原创粉丝点击