結果
問題 |
No.995 タピオカオイシクナーレ
|
ユーザー |
![]() |
提出日時 | 2020-02-22 05:09:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 673 bytes |
コンパイル時間 | 1,973 ms |
コンパイル使用メモリ | 192,916 KB |
最終ジャッジ日時 | 2025-01-09 01:47:58 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int64_t mod = 1000000007; int64_t power(int64_t n, int64_t k) { if (k == 0) return 1; int64_t ans = power(n * n % mod, k / 2); if (k % 2) ans = ans * n % mod; return ans; } int main() { int64_t n, m, k, p, q, s0 = 0, s = 0; cin >> n >> m >> k >> p >> q; for (int i = 0; i < n; i++) { int64_t b; cin >> b; s += b; if (i < m) s0 += b; } s %= mod; s0 %= mod; int64_t shalf = s * ((mod + 1) / 2) % mod, d = (s0 - shalf + mod) % mod; int64_t pq = (2 * mod + 1 - 2 * p * power(q, mod - 2)) % mod; cout << (s0 + d * power(pq, k)) << endl; }