結果

問題 No.797 Noelちゃんとピラミッド
ユーザー Pocala
提出日時 2019-03-15 23:12:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 429 bytes
コンパイル時間 1,505 ms
コンパイル使用メモリ 167,960 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-01 21:33:29
合計ジャッジ時間 4,748 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

int main() {
  int n;
  cin >> n;
  vector<ll> ncr(n);
  ncr[0] = 1;
  for (int i = 0; i < n - 1; i++) {
    ncr[i + 1] = ncr[i] * (n - 1 - i) / (i + 1);
  }

  ll a, ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    ans = (ans + (a * ncr[i] % MOD)) % MOD;
  }
  cout << ans << endl;
}
0