結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2016-07-16 15:39:12 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 737 bytes |
コンパイル時間 | 503 ms |
使用メモリ | 3,552 KB |
最終ジャッジ日時 | 2022-12-11 17:03:36 |
合計ジャッジ時間 | 1,278 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
3,552 KB |
testcase_01 | AC | 9 ms
3,448 KB |
testcase_02 | AC | 10 ms
3,540 KB |
ソースコード
#include<cstdio> #include<vector> #include<algorithm> #include<iostream> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; signed main(){ int n;cin>>n; while(n--){ int a; cin>>a; vint lis; while(a){ lis.pb(a); a=(a-1)/2; } reverse(all(lis)); int cur=0; for(auto u:lis){ if(cur*2+1==u){ cout<<"L"; } else{ cout<<"R"; } cur=u; } cout<<endl; } return 0; }