結果

問題 No.269 見栄っ張りの募金活動
ユーザー udgprogudgprog
提出日時 2020-02-25 06:53:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 737 bytes
コンパイル時間 1,928 ms
コンパイル使用メモリ 167,172 KB
実行使用メモリ 20,352 KB
最終ジャッジ日時 2024-04-21 09:15:12
合計ジャッジ時間 3,340 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
20,224 KB
testcase_01 AC 14 ms
20,224 KB
testcase_02 AC 15 ms
20,352 KB
testcase_03 AC 15 ms
20,224 KB
testcase_04 AC 18 ms
20,352 KB
testcase_05 AC 14 ms
20,224 KB
testcase_06 AC 14 ms
20,224 KB
testcase_07 AC 24 ms
20,224 KB
testcase_08 AC 15 ms
20,224 KB
testcase_09 AC 18 ms
20,224 KB
testcase_10 AC 14 ms
20,224 KB
testcase_11 AC 15 ms
20,352 KB
testcase_12 AC 18 ms
20,352 KB
testcase_13 AC 16 ms
20,224 KB
testcase_14 AC 15 ms
20,352 KB
testcase_15 AC 16 ms
20,224 KB
testcase_16 AC 17 ms
20,224 KB
testcase_17 AC 15 ms
20,352 KB
testcase_18 AC 20 ms
20,224 KB
testcase_19 AC 15 ms
20,352 KB
testcase_20 AC 14 ms
20,224 KB
testcase_21 AC 16 ms
20,352 KB
testcase_22 AC 16 ms
20,224 KB
testcase_23 AC 15 ms
20,224 KB
testcase_24 AC 15 ms
20,352 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)];
        dp[i][j]%=mod;
      }
      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