結果

問題 No.269 見栄っ張りの募金活動
ユーザー oxyshower
提出日時 2019-07-03 20:49:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 2,878 ms
コンパイル使用メモリ 166,224 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-09-16 07:18:21
合計ジャッジ時間 2,855 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

const int MOD = 1e9+7;

signed main(){

  int n,s,k; cin >> n >> s >> k;

  s -= n*(n-1)*k/2;
  if(s <= 0){
    cout << 0 << endl;
    return 0;
  }
  static int dp[20001][101]; //iをj以下の自然数の和に分ける場合の数
  dp[0][0] = 1;
  for(int i = 0; i <= s; i++){
    for(int j = 0; j <= n; j++){
      if(i-j >= 0){
        dp[i][j] = dp[i-j][j] + dp[i][j-1];
      }
      else {
        dp[i][j] = dp[i][j-1];
      }
      dp[i][j] %= MOD;
    }
  }
  cout << dp[s][n] << endl;

  return 0;
}
0