题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1846
思路: 简单的巴什博奕,如果n%(m+1)==0,则为奇异局面,后手赢,否则为先手赢。
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <algorithm>
using namespace std;
int c,n,m;
int main()
{
scanf("%d",&c);
while(c--)
{
scanf("%d%d",&n,&m);
if(n%(m+1)==0)
printf("second\n");
else
printf("first\n");
}
}