結果

問題 No.146 試験監督(1)
ユーザー cra77756176cra77756176
提出日時 2022-12-07 23:20:00
言語 Rust
(1.77.0)
結果
AC  
実行時間 21 ms / 1,000 ms
コード長 487 bytes
コンパイル時間 1,188 ms
コンパイル使用メモリ 150,656 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2024-04-22 03:44:21
合計ジャッジ時間 1,348 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

const DIVISOR: u64 = 10u64.pow(9) + 7;

fn main() {
    let mut input = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut input).ok();
    let input: Vec<u64> = input
        .split_whitespace()
        .skip(1)
        .map(|n| n.parse().unwrap())
        .collect();

    let mut answer = 0;

    for cd in input.chunks(2) {
        answer += (cd[1] % DIVISOR) * (((cd[0] + 1) / 2) % DIVISOR);
        answer %= DIVISOR;
    }

    println!("{}", answer);
}
0