結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
どらら
|
| 提出日時 | 2018-08-24 23:30:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 980 bytes |
| コンパイル時間 | 1,753 ms |
| コンパイル使用メモリ | 167,104 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 10:15:57 |
| 合計ジャッジ時間 | 2,675 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#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+1;
x -= X+1;
if(isPrime(Y) && isPrime(X)) ret = 0;
else if(isPrime(Y+1) && isPrime(X+1)) ret = 0;
else if(isPrime(Y) && isPrime(Y+1)) ret = 0;
else if(isPrime(X) && isPrime(X+1)) ret = 0;
else ret = y+x;
cerr << y << " " << x << " " << ret << endl;
if(ret%2 == 0) cout << "Second" << endl;
else cout << "First" << endl;
return 0;
}
どらら