結果
| 問題 | 
                            No.1336 Union on Blackboard
                             | 
                    
| コンテスト | |
| ユーザー | 
                             akakimidori
                         | 
                    
| 提出日時 | 2021-01-15 21:42:43 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 1,468 bytes | 
| コンパイル時間 | 13,060 ms | 
| コンパイル使用メモリ | 387,024 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-26 13:48:22 | 
| 合計ジャッジ時間 | 12,271 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 31 | 
ソースコード
// ---------- begin scannner ----------
#[allow(dead_code)]
mod scanner {
    use std::str::FromStr;
    pub struct Scanner<'a> {
        it: std::str::SplitWhitespace<'a>
    }
    impl<'a> Scanner<'a> {
        pub fn new(s: &'a String) -> Scanner<'a> {
            Scanner {
                it: s.split_whitespace()
            }
        }
        pub fn next<T: FromStr>(&mut self) -> T {
            self.it.next().unwrap().parse::<T>().ok().unwrap()
        }
        pub fn next_chars(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }
        pub fn next_vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
            (0..len).map(|_| self.next()).collect()
        }
    }
}
// ---------- end scannner ----------
use std::io::Write;
fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut sc = scanner::Scanner::new(&s);
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    run(&mut sc, &mut out);
}
fn run(sc: &mut scanner::Scanner, out: &mut std::io::BufWriter<std::io::StdoutLock>) {
    let t: usize = sc.next();
    for _ in 0..t {
        const MOD: u64 = 1_000_000_007;
        let n: usize = sc.next();
        let a: Vec<u64> = sc.next_vec(n);
        let x = a.into_iter().fold(1, |s, a| s * (a + 1) % MOD);
        let ans = (x + MOD - 1) % MOD;
        writeln!(out, "{}", ans).ok();
    }
}
            
            
            
        
            
akakimidori