結果
| 問題 |
No.995 タピオカオイシクナーレ
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2020-02-22 05:16:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 682 bytes |
| コンパイル時間 | 2,437 ms |
| コンパイル使用メモリ | 192,632 KB |
| 最終ジャッジ日時 | 2025-01-09 01:48:18 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 10 |
ソースコード
#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 << (shalf + d * power(pq, k)) % mod << endl;
}
trineutron