結果

問題 No.269 見栄っ張りの募金活動
ユーザー MiccMicc
提出日時 2019-08-18 00:44:45
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 808 bytes
コンパイル時間 1,664 ms
コンパイル使用メモリ 172,028 KB
実行使用メモリ 21,176 KB
最終ジャッジ日時 2023-10-26 02:36:01
合計ジャッジ時間 2,880 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 3 ms
4,544 KB
testcase_04 AC 14 ms
11,408 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 27 ms
21,176 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 AC 2 ms
4,372 KB
testcase_11 AC 7 ms
7,184 KB
testcase_12 AC 2 ms
4,372 KB
testcase_13 AC 5 ms
6,392 KB
testcase_14 AC 5 ms
5,864 KB
testcase_15 AC 6 ms
6,392 KB
testcase_16 AC 2 ms
4,372 KB
testcase_17 AC 2 ms
4,372 KB
testcase_18 AC 18 ms
14,840 KB
testcase_19 AC 7 ms
6,656 KB
testcase_20 AC 3 ms
4,544 KB
testcase_21 AC 4 ms
5,600 KB
testcase_22 AC 4 ms
4,808 KB
testcase_23 AC 2 ms
4,372 KB
testcase_24 AC 5 ms
5,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,s,k;
    cin>>n>>s>>k;
    if(s-k*n*(n-1)/2<0){
      cout<<0<<endl;
      return 0;
    }
    vector<vector<ll>> dp(s+10,vector<ll>(n+10,0));
    dp[0][0]=1;
    rep(i,s+1)FOR(j,1,n+1){
      if(i>=j) dp[i][j]=(dp[i-j][j]+dp[i][j-1])%mod;
      else dp[i][j]=dp[i][j-1];
    }
    cout<<dp[s-k*n*(n-1)/2][n]<<endl;
}
0