結果

問題 No.726 Tree Game
コンテスト
ユーザー RTIA1227
提出日時 2018-08-24 21:45:11
言語 C++11(廃止可能性あり)
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,169 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 490 ms
コンパイル使用メモリ 97,992 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-07 22:34:19
合計ジャッジ時間 1,071 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

bool sosu(LL n){
    if(n < 2){
        return false;
    }else if(n == 2){
        return true;
    }else if(n%2 == 0){
        return false;
    }else{
        for(LL i = 3; i <= n/i; i += 2){
            if(n%i == 0){
                return false;
            }
        }
    }
    return true;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    LL a,b;
    cin >> a >> b;

    LL enda = -1;
    LL endb = -1;

    for(LL i = a+1; enda < 0; i += 2){
        if(i%2 == 0){
            i++;
        }
        if(sosu(i)){
            enda = i;
        }
    }
    
    for(LL i = b+1; endb < 0; i += 2){
        if(i%2 == 0){
            i++;
        }
        if(sosu(i)){
            endb = i;
        }
    }

    if((abs(enda - a) + abs(endb - b))%2 == 0){
        cout << "Second" << endl;
    }else{
        cout << "First" << endl;
    }

    return 0;
}
0