結果

問題 No.726 Tree Game
ユーザー mamekin
提出日時 2018-09-17 14:22:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,074 bytes
コンパイル時間 1,040 ms
コンパイル使用メモリ 114,124 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 07:39:45
合計ジャッジ時間 1,583 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

bool primalityTest(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;
    cin >> y >> x;

    if(primalityTest(y) && primalityTest(x)){
        cout << "Second" << endl;
        return 0;
    }

    int i = 1;
    int j = 1;
    while(!primalityTest(y+i))
        ++ i;
    while(!primalityTest(x+j))
        ++ j;
    if((i + j) % 2 == 0)
        cout << "Second" << endl;
    else
        cout << "First" << endl;

    return 0;
}
0