第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <= 10000) 第2 - T + 1行:每行2个数N,K。中间用空格分隔。(1 <= N,K <= 10^9)
共T行,如果A获胜输出A,如果B获胜输出B。
4 3 2 4 2 7 3 8 3
B A A B
最简单的Bash博弈的原型题
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define FIN freopen("input.txt","r",stdin);
#define FOUT freopen("output.txt","w",stdout);
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long LL;
typedef pair<int, int> PII;
using namespace std;
int n, k;
int main() {
//FIN
int T;
scanf("%d", &T);
while(T--) {
scanf("%d%d", &n, &k);
if(n % (k + 1) != 0) printf("A\n");
else printf("B\n");
}
return 0;
}
原文:http://www.cnblogs.com/Hyouka/p/7367998.html