結果

問題 No.392 2分木をたどれ
ユーザー Mr.SpockMr.Spock
提出日時 2020-11-10 19:02:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 2,041 ms
コンパイル使用メモリ 199,164 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 00:08:57
合計ジャッジ時間 2,465 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string ans = "";
    while (n != 0) {
      if (n & 1) {
        n--;
        n = n / 2;
        ans += 'L';
      }
      else {
        n -= 2;
        n = n / 2;
        ans += 'R';
      }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
  }
}
0