HDU1846 Brave Game
题目分析
经典的巴什博奕题,具体讲解可以看这里
代码
/*
Author: Loceaner
知识点: 巴什博奕
*/
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
inline int read() {
char c = getchar(); int x = 0, f = 1;
for ( ; !isdigit(c); c = getchar()) if (c == '-') f = -1;
for ( ; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return x * f;
}
inline void solve() {
int n = read(), m = read();
if (n % (m + 1) == 0) puts("second");
else puts("first");
}
int main() {
int T = read();
while (T--) solve();
}
转载不必联系作者,但请声明出处

浙公网安备 33010602011771号