結果

問題 No.331 CodeRunnerでやれ
ユーザー yuppe19 😺
提出日時 2019-07-04 09:38:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3,870 ms / 5,000 ms
コード長 999 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 66,200 KB
実行使用メモリ 25,472 KB
平均クエリ数 20242.47
最終ジャッジ日時 2024-07-17 02:17:58
合計ジャッジ時間 24,708 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

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 << "FLR"[xorshift32() % 3] << endl;
        break;
    }
  }
  return 0;
}
0