結果

問題 No.726 Tree Game
ユーザー aim_cpoaim_cpo
提出日時 2018-10-03 11:26:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,361 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 166,972 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 10:15:12
合計ジャッジ時間 2,288 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 7
権限があれば一括ダウンロードができます

ソースコード

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