結果

問題 No.392 2分木をたどれ
ユーザー mine691mine691
提出日時 2018-07-04 13:44:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 66,812 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-07-01 02:11:58
合計ジャッジ時間 961 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 10 ms
6,940 KB
testcase_02 AC 10 ms
6,940 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