結果

問題 No.392 2分木をたどれ
ユーザー m-44m-44
提出日時 2019-09-15 09:46:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 1,486 ms
コンパイル使用メモリ 167,896 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-21 04:02:11
合計ジャッジ時間 2,200 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 9 ms
4,376 KB
testcase_02 AC 10 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int m;
  cin>>m;
  for (int i=0; i<m; i++) {
    int a;
    cin>>a;
    vector<char> route;
    while (a > 0) {
      if (a % 2 == 0) {
        route.push_back('R');
        a = (a - 2) / 2;
      } else {
        route.push_back('L');
        a = (a - 1) / 2;
      }
    }
    reverse(route.begin(), route.end());
    for (char c: route) {
      cout<<c;
    }
    cout<<endl;
  }
}
0