結果

問題 No.1102 Remnants
ユーザー たたき@競プロ
提出日時 2023-09-15 16:58:52
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 5,142 ms
コンパイル使用メモリ 309,020 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 19:15:09
合計ジャッジ時間 7,991 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  int n,k;cin>>n>>k;
  mint ans=0;
  vc<mint>comb(n+1,0); 
  comb[0]=1;
  rep(i,n)comb[i+1]=comb[i]*(i+1+k)/(i+1);
  rep(i,n){
    int a;cin>>a;
    ans+=(mint)a*comb[i]*comb[n-1-i];
  }
  cout<<ans.val();
}
0