結果
問題 | No.726 Tree Game |
ユーザー |
![]() |
提出日時 | 2018-08-25 12:07:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 654 bytes |
コンパイル時間 | 1,537 ms |
コンパイル使用メモリ | 166,608 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 06:57:39 |
合計ジャッジ時間 | 2,377 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { auto is_prime = [](int64_t n) { if (n < 2) { return false; } if (n == 2) { return true; } for (int64_t i = 2; i * i <= n; i++) { if (n % i == 0) { return false; } } return true; }; int64_t x, y; cin >> x >> y; if (is_prime(x) && is_prime(y)) { cout << "Second" << endl; return 0; } int64_t xp = x + 1, yp = y + 1; while (!is_prime(xp)) { xp++; } while (!is_prime(yp)) { yp++; } if ((xp == x) || (yp == y)) { cout << "First" << endl; return 0; } cout << ((((xp - x) + (yp - y)) % 2) ? "First" : "Second") << endl; return 0; }