結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
aim_cpo
|
| 提出日時 | 2018-10-03 11:20:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,499 bytes |
| コンパイル時間 | 1,397 ms |
| コンパイル使用メモリ | 157,660 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 10:15:10 |
| 合計ジャッジ時間 | 2,419 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 7 |
ソースコード
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int y, x;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
#ifdef LOCAL_DEFINE
FILE *stream1;
//FILE *stream2;
stream1 = freopen("in.txt", "r", stdin);
//stream2 = freopen("out.txt", "w", stdout);
if (stream1 == NULL) return 0;
//if (stream2 == NULL) return 0;
#endif
cin >> y >> x;
int res1, res2;
for (int i = y + 1; ; i++) {
if (i % 2 == 0) continue;
int now = i;
bool prime = 1;
for (int j = 2; j * j <= now; j++) {
if (now % j == 0) {
prime = 0;
break;
}
}
if (prime) {
res1 = i - y;
break;
}
}
for (int i = x + 1; ; i++) {
if (i % 2 == 0) continue;
int now = i;
bool prime = 1;
for (int j = 2; j * j <= now; j++) {
if (now % j == 0) {
prime = 0;
break;
}
}
if (prime) {
res2 = i - x;
break;
}
}
if (res1 == 0 || res2 == 0) {
cout << "Second" << endl;
} else if (res1 <= 1 && res2 <= 1) {
cout << "Second" << endl;
} else {
if ((res1 + res2) & 1) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
}
#ifdef LOCAL_DEFINE
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
fclose(stream1);
//fclose(stream2);
#endif
return 0;
}
aim_cpo