結果

問題 No.392 2分木をたどれ
ユーザー masamasa
提出日時 2016-07-14 10:30:30
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 501 ms
使用メモリ 3,512 KB
最終ジャッジ日時 2022-12-08 20:23:03
合計ジャッジ時間 1,249 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,512 KB
testcase_01 AC 8 ms
3,484 KB
testcase_02 AC 8 ms
3,432 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