結果
問題 | No.392 2分木をたどれ |
ユーザー |
|
提出日時 | 2020-11-10 19:02:33 |
言語 | C++17 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 465 bytes |
コンパイル時間 | 1,870 ms |
使用メモリ | 9,772 KB |
最終ジャッジ日時 | 2023-02-22 16:29:35 |
合計ジャッジ時間 | 2,605 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
7,600 KB |
testcase_01 | AC | 7 ms
9,672 KB |
testcase_02 | AC | 7 ms
9,772 KB |
ソースコード
#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; } }