結果

問題 No.1285 ゴミ捨て
ユーザー fukafukatani
提出日時 2020-11-13 21:35:24
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 391 bytes
コンパイル時間 15,352 ms
コンパイル使用メモリ 379,636 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 20:32:47
合計ジャッジ時間 13,791 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `i`
 --> src/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

ソースコード

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