結果
| 問題 |
No.797 Noelちゃんとピラミッド
|
| コンテスト | |
| ユーザー |
yapoo
|
| 提出日時 | 2019-03-15 21:44:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 570 bytes |
| コンパイル時間 | 1,325 ms |
| コンパイル使用メモリ | 159,196 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-01 20:39:09 |
| 合計ジャッジ時間 | 6,225 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 55 |
ソースコード
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll mod = 1e9+7;
ll inv(ll x) {
ll res = 1;
ll k = mod - 2;
ll y = x;
while (k) {
if (k & 1) res = (res * y) % mod;
y = (y * y) % mod;
k /= 2;
}
return res;
}
int main(){
int N; cin >> N;
vector<int> a(N);
for(int i=0; i<N; i++) cin >> a[i];
ll ans = 0;
ll c = 1;
for(ll i=0; i<N; i++){
ans += (c%mod)*a[i];
ans = ans%mod;
c = (N-1-i)*c*inv(i+1);
c = c%mod;
}
cout << ans << endl;
}
yapoo