結果

問題 No.1336 Union on Blackboard
ユーザー tonyu0
提出日時 2021-01-16 02:26:38
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 11,176 ms
コンパイル使用メモリ 383,280 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 20:41:55
合計ジャッジ時間 12,457 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;
const MOD: usize = 1_000_000_007;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let t: usize = itr.next().unwrap().parse().unwrap();
    for _ in 0..t {
        let n: usize = itr.next().unwrap().parse().unwrap();
        let a: Vec<usize> = (0..n)
            .map(|_| itr.next().unwrap().parse().unwrap())
            .collect();
        let mut ans = 1;
        for &e in a.iter() {
            ans = ans * (1 + e) % MOD;
        }
        println!("{}", (ans - 1 + MOD) % MOD);
    }
}
0