lightoj 1020 (博弈)
生活随笔
收集整理的這篇文章主要介紹了
lightoj 1020 (博弈)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
思路:很簡單的博弈,找出每個人先拿的必勝態進行狀態轉移即可。
#include<cstdio> #include<string> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int main(){int t, n, CASE(0);char str[10];scanf("%d", &t);while(t--){printf("Case %d: ", ++CASE);scanf("%d%s", &n, str);if(str[0] == 'B'){if(n % 3) printf("Bob\n");else printf("Alice\n");}else{if(n % 3 != 1) printf("Alice\n");else printf("Bob\n");}}return 0; }轉載于:https://www.cnblogs.com/wangzhili/p/3950201.html
總結
以上是生活随笔為你收集整理的lightoj 1020 (博弈)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MS509Team-----------
- 下一篇: 人工鱼群算法解决TSP问题