結果

問題 No.392 2分木をたどれ
ユーザー SSRSSSRS
提出日時 2020-11-17 07:57:03
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 504 ms
使用メモリ 6,280 KB
最終ジャッジ日時 2023-02-23 02:34:22
合計ジャッジ時間 1,362 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int m;
	cin >> m;
	for (int i = 0; i < m; i++){
		int A;
		cin >> A;
		string ans;
		while (A > 0){
			if (A % 2 == 1){
				ans += 'L';
			} else {
				ans += 'R';
			}
			A = (A - 1) / 2;
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
	}
}
0