結果

問題 No.392 2分木をたどれ
ユーザー Mr.SpockMr.Spock
提出日時 2020-11-10 18:58:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 1,250 ms
コンパイル使用メモリ 167,780 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 00:08:44
合計ジャッジ時間 1,884 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, w;
map<int, int>dp;
int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  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