結果
問題 |
No.1102 Remnants
|
ユーザー |
![]() |
提出日時 | 2020-07-04 01:46:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 697 bytes |
コンパイル時間 | 1,950 ms |
コンパイル使用メモリ | 91,520 KB |
最終ジャッジ日時 | 2025-01-11 15:19:19 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; constexpr int P = 1000000007; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<int> x(n), y(n); x[1] = 1; y[0] = 1; y[1] = k + 1; for (int i = 2; i < n; i++) { y[i] = (ll)y[i - 1] * (x[i] = P - (P / i * (ll)x[P % i] % P)) % P * (k + i) % P; } ll r = 0; for (int i = 0; i < n; i++) { int a; cin >> a; r += (ll)a * y[i] % P * y[n - 1 - i] % P; } r %= P; cout << r << endl; return 0; }