結果

問題 No.392 2分木をたどれ
ユーザー nobuta05nobuta05
提出日時 2016-08-23 19:08:21
言語 Rust
(1.77.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 153,900 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 13:37:33
合計ジャッジ時間 1,000 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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