結果

問題 No.392 2分木をたどれ
ユーザー 👑 obakyanobakyan
提出日時 2019-03-31 22:11:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 70,692 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-14 14:27:20
合計ジャッジ時間 1,039 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>

int main(void)
{
	int m;
	std::cin >> m;
    for(int i = 0; i < m; i++){
        int a;
        std::cin >> a;
        std::string path;
        while(0 < a){
            if(a % 2 == 0){
                path.insert(0, "R");
                a = a / 2 - 1;
            } else {
                path.insert(0, "L");
                a /= 2;
            }
        }
        std::cout << path << std::endl;
    }
	return 0;
}

0