結果
問題 |
No.392 2分木をたどれ
|
ユーザー |
![]() |
提出日時 | 2025-04-18 16:10:11 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 424 bytes |
コンパイル時間 | 3,679 ms |
コンパイル使用メモリ | 276,300 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-18 16:10:16 |
合計ジャッジ時間 | 4,090 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll T,n; int main(){ cin>>T; while(T--){ cin>>n; n++; vector<char>a; while(n!=1){ // cout<<n<<endl; if(n&1)a.push_back('R'); else a.push_back('L'); n>>=1; } for(ll i=a.size()-1;i>=0;i--)cout<<a[i]; cout<<endl; } } /* 1 2 L 10 2 3 R 11 3 4 LL 100 4 5 LR 101 5 6 RL 110 6 7 RR 111 7 8 LLL 1000 8 9 LLR 1001 ... 21 22 LRRL 10110 */