結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-24 22:37:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 670 bytes |
| コンパイル時間 | 1,418 ms |
| コンパイル使用メモリ | 166,232 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 08:16:57 |
| 合計ジャッジ時間 | 2,163 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool is_prime(int n) {
if (n % 2 == 0) return false;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) return false;
}
return n != 1;
}
int solve(int n) {
int res = 0;
while (!is_prime(n)) {
res++;
n++;
}
if (res > 0) res--;
return res;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int x, y;
cin >> y >> x;
if (is_prime(y) || is_prime(x)) {
cout << "First" << endl;
return 0;
}
int cnt = solve(y) + solve(x);
cout << (cnt % 2 == 1 ? "First" : "Second") << endl;
return 0;
}