結果

問題 No.797 Noelちゃんとピラミッド
ユーザー mint6421mint6421
提出日時 2019-07-03 00:10:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 1,126 bytes
コンパイル時間 1,603 ms
コンパイル使用メモリ 159,020 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 11:53:30
合計ジャッジ時間 6,851 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 92 ms
5,376 KB
testcase_04 AC 88 ms
5,376 KB
testcase_05 AC 96 ms
5,376 KB
testcase_06 AC 96 ms
5,376 KB
testcase_07 AC 89 ms
5,376 KB
testcase_08 AC 90 ms
5,376 KB
testcase_09 AC 91 ms
5,376 KB
testcase_10 AC 98 ms
5,376 KB
testcase_11 AC 94 ms
5,376 KB
testcase_12 AC 95 ms
5,376 KB
testcase_13 AC 93 ms
5,376 KB
testcase_14 AC 94 ms
5,376 KB
testcase_15 AC 93 ms
5,376 KB
testcase_16 AC 90 ms
5,376 KB
testcase_17 AC 93 ms
5,376 KB
testcase_18 AC 91 ms
5,376 KB
testcase_19 AC 93 ms
5,376 KB
testcase_20 AC 98 ms
5,376 KB
testcase_21 AC 97 ms
5,376 KB
testcase_22 AC 99 ms
5,376 KB
testcase_23 AC 67 ms
5,376 KB
testcase_24 AC 23 ms
5,376 KB
testcase_25 AC 58 ms
5,376 KB
testcase_26 AC 54 ms
5,376 KB
testcase_27 AC 92 ms
5,376 KB
testcase_28 AC 84 ms
5,376 KB
testcase_29 AC 13 ms
5,376 KB
testcase_30 AC 20 ms
5,376 KB
testcase_31 AC 67 ms
5,376 KB
testcase_32 AC 30 ms
5,376 KB
testcase_33 AC 57 ms
5,376 KB
testcase_34 AC 41 ms
5,376 KB
testcase_35 AC 98 ms
5,376 KB
testcase_36 AC 12 ms
5,376 KB
testcase_37 AC 84 ms
5,376 KB
testcase_38 AC 87 ms
5,376 KB
testcase_39 AC 54 ms
5,376 KB
testcase_40 AC 11 ms
5,376 KB
testcase_41 AC 16 ms
5,376 KB
testcase_42 AC 53 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 1 ms
5,376 KB
testcase_45 AC 2 ms
5,376 KB
testcase_46 AC 1 ms
5,376 KB
testcase_47 AC 1 ms
5,376 KB
testcase_48 AC 1 ms
5,376 KB
testcase_49 AC 2 ms
5,376 KB
testcase_50 AC 2 ms
5,376 KB
testcase_51 AC 1 ms
5,376 KB
testcase_52 AC 2 ms
5,376 KB
testcase_53 AC 1 ms
5,376 KB
testcase_54 AC 2 ms
5,376 KB
testcase_55 AC 2 ms
5,376 KB
testcase_56 AC 2 ms
5,376 KB
testcase_57 AC 2 ms
5,376 KB
testcase_58 AC 1 ms
5,376 KB
testcase_59 AC 1 ms
5,376 KB
testcase_60 AC 1 ms
5,376 KB
testcase_61 AC 1 ms
5,376 KB
testcase_62 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:54:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   54 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}




int fac[310000];

int inv(int x){
  if(x==1) return 1;
  return (M-M/x)*inv(M%x)%M;
}


int comb(int n,int k){
  int x=(fac[k]*fac[n-k])%M;
  return (fac[n]*inv(x))%M;
}

int fac_init(int n){
  fac[0]=1;
  FOR(i,1,n+1){
    fac[i]=fac[i-1]*i;
    fac[i]%=M;
  }
  return 0;
}

main(){
  int n;
  cin>>n;
  fac_init(n);

  int ans=0;
  rep(i,n){
    int a;
    cin>>a;
    ans+=(a*comb(n-1,i))%M;
    ans%=M;
  }

  cout<<ans<<endl;

}
0