結果
問題 | No.726 Tree Game |
ユーザー |
![]() |
提出日時 | 2018-08-24 21:37:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 745 bytes |
コンパイル時間 | 786 ms |
コンパイル使用メモリ | 80,364 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 06:51:12 |
合計ジャッジ時間 | 1,845 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <string> #include <iomanip> #include <algorithm> #include <cmath> #include <stdio.h> using namespace std; #define int long long int MOD = 1000000007; int solve(int X) { int res = X + 1; bool f; while (true) { f = false; for (int i = 2; i*i <= res; i++) { if (res%i == 0) { res++; f = true; break; } } if (f)continue; return res; } } signed main() { cin.tie(0); ios::sync_with_stdio(false); int X, Y; cin >> X >> Y; int x = solve(X); int y = solve(Y); //cerr << x << " " << y << endl; if ((X == 2 || Y == 2) || ((x - X + y - Y) % 2 == 0)) { cout << "Second" << endl; } else { cout << "First" << endl; } }