結果
問題 | No.392 2分木をたどれ |
ユーザー |
|
提出日時 | 2016-07-13 02:26:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 736 bytes |
コンパイル時間 | 1,517 ms |
コンパイル使用メモリ | 167,060 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 15:32:01 |
合計ジャッジ時間 | 1,964 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)#define all(x) (x).begin(),(x).end()#define mp make_pair#define pb push_back#define fi first#define se secondint main(){int m;cin >>m;rep(M,m){int a;cin >>a;int now=a;string ans="";while(now>0){int nx=(now-1)/2;if(2*nx+1==now) ans+="L";else if(2*nx+2==now) ans+="R";else printf("error!\n");now=nx;}reverse(all(ans));cout << ans << endl;}return 0;}