結果
問題 | No.726 Tree Game |
ユーザー |
![]() |
提出日時 | 2018-08-24 23:54:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 656 bytes |
コンパイル時間 | 1,536 ms |
コンパイル使用メモリ | 166,712 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 11:22:12 |
合計ジャッジ時間 | 2,453 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define ll long longll Y, X;bool isPrime(ll n) {if (n == 0 || n == 1) return false;for (ll i = 2; i*i <= n; i++) {if (n % i == 0) return false;}return true;}int main() {cin >> Y >> X;// 素数マスを求めるll up = Y, right = X;while (!isPrime(X)) {up++;if (isPrime(up)) break;}while (!isPrime(Y)) {right++;if (isPrime(right)) break;}up--, right--;// マンハッタン距離が奇数なら初手側の勝ちif ((up + right) % 2) {puts("First");} else {puts("Second");}return 0;}