結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー halshiphalship
提出日時 2020-10-19 17:39:59
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 762 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 148,636 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 13:21:02
合計ジャッジ時間 1,329 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

use std::io::{self, BufRead, BufReader, BufWriter, Write};

fn main() {
    let stdin = io::stdin();
    let mut stdin = BufReader::new(stdin.lock());
    let stdout = io::stdout();
    let mut stdout = BufWriter::new(stdout.lock());

    let n: u8 = read_line(&mut stdin).trim_end().parse().unwrap();

    for i in 1..n + 1 {
        match (i % 3, i % 5) {
            (0, 0) => writeln!(&mut stdout, "FizzBuzz").unwrap(),
            (0, _) => writeln!(&mut stdout, "Fizz").unwrap(),
            (_, 0) => writeln!(&mut stdout, "Buzz").unwrap(),
            _ => writeln!(&mut stdout, "{}", i).unwrap(),
        }
    }
}

fn read_line<R: BufRead>(reader: &mut R) -> String {
    let mut buf = String::new();
    reader.read_line(&mut buf).unwrap();
    buf
}
0