結果

問題 No.726 Tree Game
ユーザー firiexp
提出日時 2018-08-24 22:06:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 79,316 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 07:30:59
合計ジャッジ時間 1,736 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>

static const int INF = 1000000007;
using ll = long long;
using namespace std;

bool is_prime(long long n) {
    if (n < 2) return false;
    for (long long i = 2; i * i <= n; ++i) {
        if (n % i == 0) return false;
    }
    return true;
}

int main() {
    int y, x, yy, xx;
    cin >> y >> x;

    for (int i = x+1;; ++i) {
        if (is_prime(i)) {
            xx = i;
            break;
        }
    }
    for (int i = y+1;; ++i) {
        if (is_prime(i)) {
            yy = i;
            break;
        }
    }
    int dis = (yy - y - 1) + (xx - x - 1);
    if(dis%2) cout << "First" << "\n";
    else cout << "Second" << "\n";
    return 0;
}
0