牛客练习赛67 C. 牛牛爱博弈
牛牛爱博弈
https://ac.nowcoder.com/acm/contest/6885/C
Description
Solution
打表,得到的表如下(0代表Frame,1代表Alan):
n ans
1 1
2 1
3 0
4 1(可以转化为3 必败态给对手)
5 1(可以转化为3 必败态给对手)
6 0
7 1(可以转化为6 必败态给对手)
8 1(可以转化为6 必败态给对手)
9 0
看出规律,3的倍数时为必败态。
Code
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int T; cin >> T;
while(T--) {
int x; cin >> x;
if(x % 3 == 0) {
cout << "Frame\n";
} else {
cout << "Alan\n";
}
}
return 0;
}
查看9道真题和解析