結果

問題 No.499 7進数変換
ユーザー phspls
提出日時 2020-02-22 12:33:39
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 439 bytes
コンパイル時間 11,887 ms
コンパイル使用メモリ 389,876 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-09 15:57:47
合計ジャッジ時間 12,980 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let mut n: usize = n.trim().parse().unwrap();
    let org_n: usize = n;

    let mut result: Vec<usize> = vec![];
    while n > 0 {
        result.push(n % 7);
        n /= 7;
    }
    if org_n == 0 {
        println!("0");
    } else {
        println!("{}", result.iter().rev().map(|i| i.to_string()).collect::<Vec<String>>().join(""));
    }
}
0