結果

問題 No.726 Tree Game
ユーザー aim_cpoaim_cpo
提出日時 2018-10-03 11:26:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,361 bytes
コンパイル時間 1,378 ms
コンパイル使用メモリ 164,076 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 14:39:57
合計ジャッジ時間 2,052 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
6,948 KB
testcase_09 WA -
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 WA -
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    }
  }
  res1++; res2++;
  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;
}
0