結果

問題 No.3022 縛りFizzBuzz (Easy)
ユーザー tubo28tubo28
提出日時 2017-03-31 23:19:19
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 844 ms
コンパイル使用メモリ 145,856 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 11:34:16
合計ジャッジ時間 1,687 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: use of deprecated associated function `core::str::<impl str>::trim_right`: superseded by `trim_end`
 --> Main.rs:5:27
  |
5 |     let n: usize = buffer.trim_right().parse().unwrap();
  |                           ^^^^^^^^^^
  |
  = note: `#[warn(deprecated)]` on by default
help: replace the use of the deprecated associated function
  |
5 |     let n: usize = buffer.trim_end().parse().unwrap();
  |                           ~~~~~~~~

warning: 1 warning emitted

ソースコード

diff #

fn main() {
    use std::io::Read;
    let mut buffer = String::new();
    std::io::stdin().read_to_string(&mut buffer).unwrap();
    let n: usize = buffer.trim_right().parse().unwrap();
    let zero  = "".len();
    let one   = " ".len();
    let three = "   ".len();
    let five  = "     ".len();
    for i in zero..n {
        let i = i + one;
        if i % three == zero && i % five == zero {
            println!("FizzBuzz");
        } else if i % three == zero {
            println!("Fizz");
        } else if i % five == zero {
            println!("Buzz");
        } else {
            println!("{}", i);
        }
    }
}
0