結果
問題 | No.1489 Repeat Cumulative Sum |
ユーザー | Mister |
提出日時 | 2021-04-23 21:46:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 598 bytes |
コンパイル時間 | 922 ms |
コンパイル使用メモリ | 77,704 KB |
最終ジャッジ日時 | 2025-01-20 23:44:45 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <atcoder/modint> #include <iostream> #include <algorithm> #include <vector> using namespace std; using lint = long long; using mint = atcoder::modint1000000007; void solve() { int n; lint m; cin >> n >> m; --m; vector<int> xs(n - 1); for (auto& x : xs) cin >> x; reverse(xs.begin(), xs.end()); mint c = 1, ans = 0; for (int i = 1; i <= n - 1; ++i) { c = c * (m + i) / i; ans += c * xs[i - 1]; } cout << ans.val() << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }