結果

問題 No.726 Tree Game
ユーザー Khiromu
提出日時 2018-08-25 01:11:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 766 bytes
コンパイル時間 1,722 ms
コンパイル使用メモリ 166,380 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 17:14:07
合計ジャッジ時間 2,535 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll y, x;
bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}
int main() {
    cin>>y>>x;

    y++; x++;
    ll ans=0;

    while(!IsPrime(y)){
        ans++;
        y++;
    }
    while(!IsPrime(x)){
        ans++;
        x++;
    }

    if(ans%2==0) cout<<"Second"<<endl;
    else cout<<"First"<<endl;
    return 0;
}
0