結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
どらら
|
| 提出日時 | 2018-08-24 23:14:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 932 bytes |
| コンパイル時間 | 1,633 ms |
| コンパイル使用メモリ | 166,684 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 09:41:42 |
| 合計ジャッジ時間 | 2,536 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;
bool isPrime(ll n){
if(n<=1) return false;
if(n==2) return true;
if(n%2==0) return false;
ll m=sqrt(n);
for(ll i=3; i<=m; i+=2) if(n%i==0) return false;
return true;
}
int main(){
ll Y, X;
cin >> Y >> X;
ll ret = 0;
ll y = Y+1; while(!isPrime(y)) y++;
ll x = X+1; while(!isPrime(x)) x++;
y -= Y;
x -= X;
if(isPrime(Y) && isPrime(X)) ret = 0;
else if(isPrime(Y+1) && isPrime(X+1)) ret = 0;
else if(isPrime(Y)) ret = x + y-1;
else if(isPrime(X)) ret = y + x-1;
else ret = y+x;
cerr << ret << endl;
if(ret%2 == 0) cout << "Second" << endl;
else cout << "First" << endl;
return 0;
}
どらら