結果
問題 | No.1181 Product Sum for All Subsets |
ユーザー |
![]() |
提出日時 | 2020-08-22 11:15:42 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,128 bytes |
コンパイル時間 | 15,399 ms |
コンパイル使用メモリ | 401,128 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-15 06:52:06 |
合計ジャッジ時間 | 14,108 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 16 |
ソースコード
pub struct ProconReader<R: std::io::Read> {reader: R,}impl<R: std::io::Read> ProconReader<R> {pub fn new(reader: R) -> Self {Self { reader }}pub fn get<T: std::str::FromStr>(&mut self) -> T {use std::io::Read;let buf = self.reader.by_ref().bytes().map(|b| b.unwrap()).skip_while(|&byte| byte == b' ' || byte == b'\n' || byte == b'\r').take_while(|&byte| byte != b' ' && byte != b'\n' && byte != b'\r').collect::<Vec<_>>();std::str::from_utf8(&buf).unwrap().parse().ok().expect("Parse Error.")}}fn main() {let stdin = std::io::stdin();let mut rd = ProconReader::new(stdin.lock());let mo = 1000000000 + 7;let n: i64 = rd.get();let k: i64 = rd.get();let k = k % mo;let mut a = 1;let mut b = 1;for _ in 0..n {a = a * (k * (k + 3) / 2) % mo;a = a % mo;b = b * (k * (k + 1) / 2) % mo;b = b % mo;}println!("{}", (a - b + mo) % mo);}