結果

問題 No.331 CodeRunnerでやれ
コンテスト
ユーザー yuppe19 😺
提出日時 2019-07-04 09:38:01
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 999 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 252 ms
コンパイル使用メモリ 62,316 KB
最終ジャッジ日時 2026-03-31 16:33:54
合計ジャッジ時間 545 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:4:13: error: 'uint32_t' does not name a type
    4 | using u32 = uint32_t;
      |             ^~~~~~~~
main.cpp:2:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    1 | #include <iostream>
  +++ |+#include <cstdint>
    2 | using namespace std;
main.cpp:6:1: error: 'u32' does not name a type
    6 | u32 uy = u32(time(NULL));
      | ^~~
main.cpp:7:1: error: 'u32' does not name a type
    7 | u32 xorshift32() {
      | ^~~
main.cpp:14:8: error: 'u32' does not name a type
   14 | inline u32 myhash(const string &s) {
      |        ^~~
main.cpp: In function 'int main()':
main.cpp:40:12: error: 'myhash' was not declared in this scope
   40 |     switch(myhash(s)) {
      |            ^~~~~~
main.cpp:47:23: error: 'xorshift32' was not declared in this scope
   47 |         cout << "FLR"[xorshift32() % 2 + 1] << endl;
      |                       ^~~~~~~~~~

ソースコード

diff #
raw source code

#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