結果

問題 No.269 見栄っ張りの募金活動
ユーザー udgprogudgprog
提出日時 2020-02-25 06:41:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 721 bytes
コンパイル時間 1,558 ms
コンパイル使用メモリ 167,036 KB
実行使用メモリ 20,480 KB
最終ジャッジ日時 2024-04-21 08:54:56
合計ジャッジ時間 2,817 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
20,224 KB
testcase_01 AC 14 ms
20,224 KB
testcase_02 AC 14 ms
20,224 KB
testcase_03 AC 14 ms
20,352 KB
testcase_04 AC 16 ms
20,224 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 14 ms
20,224 KB
testcase_09 AC 15 ms
20,352 KB
testcase_10 AC 13 ms
20,352 KB
testcase_11 AC 14 ms
20,096 KB
testcase_12 AC 16 ms
20,224 KB
testcase_13 AC 15 ms
20,352 KB
testcase_14 WA -
testcase_15 AC 15 ms
20,352 KB
testcase_16 AC 15 ms
20,224 KB
testcase_17 AC 15 ms
20,224 KB
testcase_18 AC 17 ms
20,352 KB
testcase_19 AC 15 ms
20,352 KB
testcase_20 AC 14 ms
20,352 KB
testcase_21 AC 14 ms
20,224 KB
testcase_22 AC 15 ms
20,224 KB
testcase_23 AC 14 ms
20,224 KB
testcase_24 AC 14 ms
20,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;
const int NMAX = 105;
const int SMAX = 20010;

int main(){
  int n, s, k;
  cin >> n >> s >> k;
  vector<vector<ll> > dp(NMAX, vector<ll>(SMAX));
  for(int j=0; j*n<=s;j++){
    dp[0][j*n]=1;
  }
  for(int i=1; i<=n-1; i++){
    rep(j, s+1){
      if(j-(n-i)>=0){
        dp[i][j]=dp[i][j-(n-i)];
        if(j-k*(n-i)>=0){
          dp[i][j]+=dp[i-1][j-k*(n-i)];
          dp[i][j]%=mod;
        }
      }
    }
  }
  cout << dp[n-1][s] << endl;
  return 0;
}
0