結果

問題 No.392 2分木をたどれ
ユーザー nobuta05nobuta05
提出日時 2016-08-23 19:08:21
言語 Rust
(1.59.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 740 ms
使用メモリ 1,964 KB
最終ジャッジ日時 2022-12-14 08:27:29
合計ジャッジ時間 1,586 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

fn main() {
    let mut num = String::new();
    std::io::stdin().read_line(&mut num).ok().expect("ERROR");
    let num: usize = num.trim().parse().ok().expect("ERROR");

    for _ in 0..num {
        let mut n = String::new();
        std::io::stdin().read_line(&mut n).ok().expect("ERROR");
        let mut n: usize = n.trim().parse().ok().expect("ERROR");

        let mut res = String::new();
        while n > 0 {
            if n % 2 == 0 {
                res = format!("{}{}", "R", res);
            }
            else {
                res = format!("{}{}", "L", res);
            }
            n = (n-1) >> 1;
        }
        println!("{}", res);
    }
}
0