結果

問題 No.392 2分木をたどれ
ユーザー Mr.Spock
提出日時 2020-11-10 19:02:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 1,852 ms
コンパイル使用メモリ 195,344 KB
最終ジャッジ日時 2025-01-15 21:58:57
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

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