結果

問題 No.392 2分木をたどれ
ユーザー mine691mine691
提出日時 2018-07-04 13:44:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 65,828 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 17:30:24
合計ジャッジ時間 1,023 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;

int bitget(int a){
	int ans = 0;
	while (a > 0){
		a /= 2;
		ans++;
	}
	return ans;
}

int main(){
	int n;
	cin >> n;
	int a[10000];
	for (int i = 0; i < n; i++){
		cin >> a[i];
		a[i]++;
	}
	for (int i = 0; i < n; i++){
		for (int j = bitget(a[i])-2; j >=0; j--){
			if (a[i] & (1 << j))cout << "R";
			else cout << "L";
		}
		cout << endl;
	}
}
0