結果

問題 No.331 CodeRunnerでやれ
コンテスト
ユーザー yuppe19 😺
提出日時 2019-07-04 09:30:40
言語 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  
(最初)
実行時間 -
コード長 856 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 383 ms
コンパイル使用メモリ 62,192 KB
最終ジャッジ日時 2026-03-31 07:01:20
合計ジャッジ時間 776 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_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:34:12: error: 'myhash' was not declared in this scope
   34 |     switch(myhash(s)) {
      |            ^~~~~~
main.cpp:41:23: error: 'xorshift32' was not declared in this scope
   41 |         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:
      switch(s.size()) {
        case 8:
          return 20151224U;
        default:
          return stoi(s);
      }
  }
  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