結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
kaito_tateyama
|
| 提出日時 | 2018-08-25 14:12:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,318 bytes |
| コンパイル時間 | 1,941 ms |
| コンパイル使用メモリ | 159,512 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-26 00:07:47 |
| 合計ジャッジ時間 | 3,170 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 7 |
ソースコード
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)
#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
bool is_prime(int n) {
for (int i = 2; i*i <= n; ++i) {
if (n % i == 0) return false;
}
return true;
}
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
// ifstream in("input.txt");
// cin.rdbuf(in.rdbuf());
ll y,x;cin>>y>>x;
string ans;
ll cnt=0LL;
// 1,2のコーナーケース処理
if(y<=2 && x<=2){
ans="Second";
//どうがんばってもFirstは素数マスに動かさざるを得ない
}else if(is_prime(x) && is_prime(y)){
ans="Second";
}else{
while(is_prime(x)){
cnt++;
x++;
}
while(is_prime(y)){
cnt++;
y++;
}
if(cnt%2==0){
ans="Second";
}else{
ans="First";
}
}
P(ans);
return 0;
}
kaito_tateyama