結果

問題 No.392 2分木をたどれ
ユーザー kapokapo
提出日時 2016-07-12 17:21:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 65,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 15:35:48
合計ジャッジ時間 856 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <sstream>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)

string solve()
{
	string str;
	int A;
	cin >> A;
	while(A > 0) {
		string str2;
		if(A%2) {
			str2 = str;
			str = "L";
			str += str2;
			A = A/2;
		} else {
			str2 = str;
			str = "R";
			str += str2;
			A = A/2 -1;
		}
	}
	return str;
}

int main()
{
	int M;
	cin >> M;
	rep(i,0,M) {
		string str = solve();
		cout << str << endl;
	}
	return 0;
}
0