結果

問題 No.269 見栄っ張りの募金活動
ユーザー oxyshoweroxyshower
提出日時 2019-07-03 20:49:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 1,579 ms
コンパイル使用メモリ 165,048 KB
実行使用メモリ 19,312 KB
最終ジャッジ日時 2023-10-14 12:27:59
合計ジャッジ時間 3,099 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 20 ms
17,972 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 14 ms
15,544 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 8 ms
10,276 KB
testcase_14 AC 17 ms
19,096 KB
testcase_15 AC 11 ms
12,136 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,352 KB
testcase_18 AC 10 ms
11,532 KB
testcase_19 AC 6 ms
7,992 KB
testcase_20 AC 7 ms
8,592 KB
testcase_21 AC 15 ms
16,424 KB
testcase_22 AC 6 ms
7,380 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 10 ms
12,132 KB
権限があれば一括ダウンロードができます

ソースコード

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