結果

問題 No.1168 Digit Sum Sequence
コンテスト
ユーザー Strorkis
提出日時 2020-08-14 21:25:28
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 2,000 ms
+ 902µs
コード長 409 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 365 ms
コンパイル使用メモリ 170,220 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-13 06:14:46
合計ジャッジ時間 2,548 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let mut n: usize = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().parse().unwrap()
    };

    let f = |mut n: usize| -> usize {
        let mut res = 0;
        while n > 0 {
            res += n % 10;
            n /= 10;
        }
        res
    };

    for _ in 0..99 {
        n = f(n);
    }
    println!("{}", n);
}
0