結果
問題 | No.102 トランプを奪え |
ユーザー |
![]() |
提出日時 | 2014-12-14 23:50:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 605 bytes |
コンパイル時間 | 597 ms |
コンパイル使用メモリ | 79,152 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-11 21:09:57 |
合計ジャッジ時間 | 1,075 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> using namespace std; int grundy(int x){ set<int> s; for(int i=1; i<=3; i++){ if( x-i < 0 ) break; s.insert( grundy(x-i) ); } int ret = 0; while( s.count(ret) ) ret++; return ret; } int main(){ int a,b,c,d; cin >> a >> b >> c >> d; int ans = 0; ans ^= grundy(a); ans ^= grundy(b); ans ^= grundy(c); ans ^= grundy(d); cout << ( ans==0? "Jiro":"Taro") << endl; return 0; }