結果

問題 No.331 CodeRunnerでやれ
ユーザー yuppe19 😺yuppe19 😺
提出日時 2019-07-04 09:41:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,129 ms / 5,000 ms
コード長 1,000 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 66,220 KB
実行使用メモリ 24,420 KB
平均クエリ数 6301.29
最終ジャッジ日時 2023-09-24 02:16:18
合計ジャッジ時間 20,060 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
24,048 KB
testcase_01 AC 154 ms
24,300 KB
testcase_02 AC 329 ms
23,452 KB
testcase_03 AC 171 ms
24,304 KB
testcase_04 AC 261 ms
23,664 KB
testcase_05 AC 197 ms
23,688 KB
testcase_06 AC 349 ms
24,000 KB
testcase_07 AC 548 ms
23,572 KB
testcase_08 AC 369 ms
24,004 KB
testcase_09 AC 2,129 ms
23,668 KB
testcase_10 AC 345 ms
23,992 KB
testcase_11 AC 1,092 ms
24,012 KB
testcase_12 AC 977 ms
23,632 KB
testcase_13 AC 1,520 ms
23,616 KB
testcase_14 AC 628 ms
24,420 KB
testcase_15 AC 680 ms
24,088 KB
testcase_16 AC 1,023 ms
24,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

using u32 = uint32_t;

u32 uy = u32(time(NULL));
u32 xorshift32() {
  uy ^= uy << 14;
  uy ^= uy >> 13;
  uy ^= uy << 15;
  return uy;
}

inline u32 myhash(const string &s) {
  switch(s[0]) {
    case 'M':
      return 987'654'321U;
    default:
      size_t n = s.size();
      switch(n) {
        case 8:
          return 20151224U;
        default:
          int res = 0;
          for(size_t i=0; i<n; ++i) {
            res *= 10;
            res += s[i] - '0';
          }
          return res;
      }
  }
  return -1;
}

int main(void) {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  string s;
  for(;;) {
    getline(cin, s);
    switch(myhash(s)) {
      case 987'654'321U:
        return 0;
      case 20151224:
        cout << 'F' << endl;
        break;
      case 0:
        cout << "FLR"[xorshift32() % 2 + 1] << endl;
        break;
      default:
        cout << "FFLR"[xorshift32() % 4] << endl;
        break;
    }
  }
  return 0;
}
0