結果
問題 | No.392 2分木をたどれ |
ユーザー |
|
提出日時 | 2016-07-12 11:13:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 2,668 bytes |
コンパイル時間 | 1,807 ms |
コンパイル使用メモリ | 174,556 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 14:19:57 |
合計ジャッジ時間 | 2,179 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS#define _USE_MATH_DEFINES#include "bits/stdc++.h"#define REP(i,a,b) for(i=a;i<b;++i)#define rep(i,n) REP(i,0,n)#define ll long long#define ull unsigned lltypedef long double ld;#define ALL(a) (a).begin(),(a).end()#define ifnot(a) if(not a)#define dump(x) cerr << #x << " = " << (x) << endlusing namespace std;void reader(int &a) { scanf("%d", &a); }void reader(double &a) { scanf("%lf", &a); }void reader(char a[]) { scanf("%s", a); }void reader(char &a) { scanf(" %c", &a); }void reader(ll &a) { scanf("%lld", &a); }void reader(ull &a) { scanf("%llu", &a); }// void reader(string& a){cin >> a;};template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }void writer(const int a, char c) { printf("%d", a); putchar(c); }void writer(const ll a, char c) { printf("%lld", a); putchar(c); }void writer(const ull a, char c) { printf("%llu", a); putchar(c); }void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }void writer(const char a[]) { printf("%s", a); };void writer(const char a[], char c) { printf("%s", a); putchar(c); };void writer(const char a, char c) { putchar(a); putchar(c); };template<class T> void writerLn(T t) { writer(t, '\n'); }template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n- 1], '\n'); }vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }// #define int llbool test = 0;int dx[] = { 0,1,0,-1 };int dy[] = { 1,0,-1,0 };#define INF (1 << 28)ull mod = (int)1e9 + 7;//.....................#define MAX 20int N, M;ull dp[1000000];//void dfs(vector<char>& route) {////}signed main(void){int i, j, k, l;int loop;cin >> M;rep(loop, M) {int a;cin >> a;vector<char> route;REP(i, 1, 1e4) {if (a < (1 << i) - 1) break;}--i;a -= (1 << i) - 1;rep(j, i) {if (a % 2) route.push_back('R');else route.push_back('L');a >>= 1;}for (j = i-1; j > -1; --j) {cout << route[j];}cout << endl;}return 0;}