結果
問題 |
No.726 Tree Game
|
ユーザー |
![]() |
提出日時 | 2018-08-24 22:51:42 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 840 bytes |
コンパイル時間 | 450 ms |
コンパイル使用メモリ | 59,128 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 08:37:53 |
合計ジャッジ時間 | 1,252 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 3 |
ソースコード
#include <iostream> #include <math.h> using namespace std; typedef long long ll; ll x, y, ans; int main(void){ // Your code here! cin >> x >> y; bool G = true; for (ll i = 2; i <= sqrt(x); i++){ if (x % i == 0) G = false; } for (ll i = 2; i <= sqrt(y); i++){ if (y % i == 0) G = false; } if (G){ cout << "Second" << endl; return 0; } while(true){ x++, ans++; bool sosu = true; for (ll i = 2; i <= sqrt(x); i++){ if (x % i == 0) sosu = false; } if (sosu) break; } while(true){ y++, ans++; bool sosu = true; for (ll i = 2; i <= sqrt(y); i++){ if (y % i == 0) sosu = false; } if (sosu) break; } cout << (ans % 2 == 0 ? "Second" : "First") << endl; }