牛客练习赛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;
}
全部评论
看出规律?就这?
点赞 回复 分享
发布于 2020-08-15 12:59

相关推荐

09-30 15:27
已编辑
成都工业学院 企业文化
Morpheus_:候选人:还需要测验武力值?
投递腾讯等公司10个岗位
点赞 评论 收藏
分享
评论
4
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务