結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー 小松秀行小松秀行
提出日時 2020-07-28 23:55:21
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 636 bytes
コンパイル時間 4,614 ms
コンパイル使用メモリ 136,304 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 06:55:55
合計ジャッジ時間 2,575 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

use std::fmt::Debug;
use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
    where T: FromStr, <T as FromStr>::Err: Debug {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

fn main() {
    let line1: Vec<usize> = read_line();
    let n: usize = line1[0];

    (1..n + 1).for_each(|x| {
        match x {
            it if it % 15 == 0 => println!("FizzBuzz"),
            it if it % 5 == 0 => println!("Buzz"),
            it if it % 3 == 0 => println!("Fizz"),
            _ => println!("{}", x)
        }
    });
}
0