結果

問題 No.392 2分木をたどれ
ユーザー masamasa
提出日時 2016-07-14 10:30:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 605 ms
コンパイル使用メモリ 70,648 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 17:51:54
合計ジャッジ時間 1,109 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 8 ms
6,940 KB
testcase_02 AC 8 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;


void solve(int a) {
	a++;
	string s;
	while (a > 1) {
		s += a & 1 ? "R" : "L";
		a >>= 1;
	}
	reverse(s.begin(), s.end());

	cout << s << endl;
}

int main() {
	int m, a;

	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> a;
		solve(a);
	}
	return 0;
}
0