結果

問題 No.1285 ゴミ捨て
ユーザー fukafukatanifukafukatani
提出日時 2020-11-13 21:35:24
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 391 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 140,972 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-30 02:37:39
合計ジャッジ時間 1,976 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 10 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 9 ms
4,376 KB
testcase_11 AC 9 ms
4,376 KB
testcase_12 AC 7 ms
4,380 KB
testcase_13 AC 7 ms
4,380 KB
testcase_14 AC 10 ms
4,380 KB
testcase_15 AC 7 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 5 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 11 ms
4,504 KB
testcase_23 AC 11 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `i`
 --> Main.rs:4:9
  |
4 |     for i in 0..n {
  |         ^ help: if this is intentional, prefix it with an underscore: `_i`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn main() {
    let n = read::<usize>();
    let mut a = vec![];
    for i in 0..n {
        a.push(read::<i64>());
    }
    if (0..n - 1).all(|i| a[i + 1] - a[i] > 1) {
        println!("1");
    } else {
        println!("2");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
0