結果

問題 No.146 試験監督(1)
コンテスト
ユーザー norioc
提出日時 2026-04-02 23:50:26
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 31 ms / 1,000 ms
コード長 756 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,864 ms
コンパイル使用メモリ 195,632 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-04-03 10:38:40
合計ジャッジ時間 8,801 ms
ジャッジサーバーID
(参考情報)
judge4_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#![allow(non_snake_case)]

#[allow(unused_imports)]
use proconio::{input, marker::Usize1, marker::Chars};
#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! d {
    ( $( $x:expr ),* $(,)? ) => {
        println!(
            concat!( $( stringify!($x), "={:?} " ),* ),
            $( $x ),*
        );
    };
}

fn divmod(a: i64, b: i64) -> (i64, i64) {
    (a.div_euclid(b), a.rem_euclid(b))
}

const MOD: i64 = 1_000_000_007;

fn main() {
    input! {
        N: usize,
    }

    let mut ans: i64 = 0;
    for _ in 0..N {
        input! { C: i64, D: i64 }

        let (d, m) = divmod(C, 2);
        let x = ((d + m) % MOD) * (D % MOD) % MOD;
        ans += x;
        ans %= MOD;
    }

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