結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2016-07-12 13:03:59 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 497 bytes |
コンパイル時間 | 1,036 ms |
使用メモリ | 6,952 KB |
最終ジャッジ日時 | 2022-12-08 17:05:26 |
合計ジャッジ時間 | 1,798 ms |
ジャッジサーバーID (参考情報) |
judge16 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,952 KB |
testcase_01 | AC | 8 ms
4,904 KB |
testcase_02 | AC | 8 ms
4,900 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; #define pb push_back #define mp make_pair #define fi first #define se second string solve(int p) { string s,r; while(p!=0) { if(p%2) { p=(p-1)/2; s+="L"; } else { p=(p-2)/2; s+="R"; } } for(int i=s.length()-1;i>=0;i--)r+=s[i]; return r; } int main() { int n,a; cin>>n; for(int i=0;i<n;i++) { cin>>a; cout<<solve(a)<<endl; } return 0; }