CodeForces - 451A - Game With Sticks(博弈论)
生活随笔
收集整理的這篇文章主要介紹了
CodeForces - 451A - Game With Sticks(博弈论)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題目鏈接:點擊查看
題目大意:給出n根豎著的棍子,m根橫著的棍子,每個人輪流選擇交點,被選中的交點需要刪除組成該交點的兩個棍子,選最后一個交點的人獲勝,問誰能獲勝
題目分析:簡單博弈,我們只要選擇n和m中較小的那個數,判斷奇偶即可,原理很容易想,就不過多解釋了。
代碼:
#include<iostream> #include<string> #include<cstring> #include<cstdio> #include<algorithm> #include<climits> #include<cmath> #include<cctype> #include<stack> #include<queue> #include<list> #include<vector> #include<set> #include<map> #include<sstream> using namespace std;typedef long long LL;const int inf=0x3f3f3f3f;const int N=1e5+100;int main() { // freopen("input.txt","r",stdin);int n,m;cin>>n>>m;if(min(n,m)&1)cout<<"Akshat"<<endl;elsecout<<"Malvika"<<endl;return 0; }?
超強干貨來襲 云風專訪:近40年碼齡,通宵達旦的技術人生總結
以上是生活随笔為你收集整理的CodeForces - 451A - Game With Sticks(博弈论)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2019ICPC(南昌) - Hello
- 下一篇: (转)KMP算法原理讲解及模板C实现