結果

問題 No.392 2分木をたどれ
ユーザー ku_material_roku_material_ro
提出日時 2016-09-26 00:34:57
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 58,056 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-11 20:07:32
合計ジャッジ時間 843 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main(){
	int m;
	int n;
	string s;
	cin >> m;
	int a[4096];
	for (int i = 0; i < m; i++){
		cin >> a[i];
		a[i] += 1;
	}
	for (int i = 0; i < m; i++){
		while (1){
			if (a[i] == 1){
				cout << s << endl;
				s = "";
				break;
			}
			n = a[i] % 2;
			if (n == 0){
				s.insert(s.begin(), 'L');
			}
			else{
				s.insert(s.begin(), 'R');
			}
			a[i] /= 2;

		}
	}





	
	return 0;
}
0