結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2016-07-12 01:29:25 |
言語 | C++14 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 544 bytes |
コンパイル時間 | 555 ms |
使用メモリ | 5,156 KB |
最終ジャッジ日時 | 2022-12-08 16:46:31 |
合計ジャッジ時間 | 1,282 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,156 KB |
testcase_01 | AC | 8 ms
4,904 KB |
testcase_02 | AC | 7 ms
5,156 KB |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; string solve(int n){ string ret=""; while(n!=0){ if((n-1)%2) ret.push_back('R'); else ret.push_back('L'); n=(n-1)/2; } reverse(ret.begin(),ret.end()); return ret; } int main(void){ int m; cin>>m; vector<int> a(m); vector<string> ans(m); for(int i=0;i<m;i++){ cin>>a[i]; ans[i]=solve(a[i]); } for(int i=0;i<m;i++){ cout<<ans[i]<<endl; } }