結果

問題 No.269 見栄っ張りの募金活動
ユーザー umezoumezo
提出日時 2023-12-14 03:45:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 528 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 201,008 KB
実行使用メモリ 20,704 KB
最終ジャッジ日時 2023-12-14 03:45:38
合計ジャッジ時間 3,633 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 4 ms
6,676 KB
testcase_04 AC 17 ms
20,576 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 17 ms
20,704 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 16 ms
16,768 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 9 ms
10,976 KB
testcase_14 AC 20 ms
20,608 KB
testcase_15 AC 11 ms
12,896 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 7 ms
12,384 KB
testcase_19 AC 4 ms
8,544 KB
testcase_20 AC 8 ms
9,088 KB
testcase_21 AC 17 ms
17,792 KB
testcase_22 AC 6 ms
7,904 KB
testcase_23 AC 3 ms
6,676 KB
testcase_24 AC 12 ms
12,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

const int MOD=1e9+7;
ll dp[20202][110];

int main(){
  int n,s,k;
  cin>>n>>s>>k;
  if(s-(n-1)*n*k/2<0){
    cout<<0<<endl;
    return 0;
  }
  
  dp[0][0]=1;
  for(int i=0;i<=s-(n-1)*n*k/2;i++){
    for(int j=1;j<=n;j++){
      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-(n-1)*n*k/2][n]<<endl;
  
  return 0; 
}
0