結果

問題 No.481 1から10
ユーザー mtwtkmanmtwtkman
提出日時 2019-10-14 17:05:20
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 880 ms
コンパイル使用メモリ 152,204 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-25 18:49:30
合計ジャッジ時間 1,575 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

use std::io::{self, Read};

fn read_stdin() -> Vec<String> {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer).ok();
    buffer.trim().split('\n').map(|s| s.to_string()).collect()
}

fn main() {
    let input: Vec<usize> = read_stdin()[0].split(' ').map(|s| s.parse::<usize>().unwrap()).collect();
    let mut iter = input.iter();
    let i = iter.next();
    if i == Some(&2) {
        println!("{}", 1);
        return
    }
    for (x, y) in input.iter().zip(iter.collect::<Vec<&usize>>()) {
        if y - x != 1 {
            println!("{}", y - 1);
            return
        }
    }
    println!("{}", 10);
}
0