結果

問題 No.269 見栄っ張りの募金活動
ユーザー irohasu_takaokairohasu_takaoka
提出日時 2019-01-16 23:44:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 754 bytes
コンパイル時間 3,861 ms
コンパイル使用メモリ 144,780 KB
実行使用メモリ 11,200 KB
最終ジャッジ日時 2023-09-13 22:17:42
合計ジャッジ時間 3,665 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 3 ms
7,664 KB
testcase_04 AC 6 ms
7,336 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
7,840 KB
testcase_07 AC 13 ms
11,200 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 4 ms
6,388 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 6 ms
8,620 KB
testcase_19 AC 3 ms
6,184 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

/*
n s k

n 100
s 20000
k 100
 */

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}

const int MAX = pow(10,9) + 7;

int n,s,k,S;
int dp[101][20001];

int main(){
  cin >> n >> s >> k;
  S = s - n * (n - 1) * k / 2;

  REP(j,S+1)
    dp[1][j] = 1;
  
  FOR_IN(i,2,n+1){
    REP(j,S+1){
      if(j>=i)
        dp[i][j] = (dp[i][j-i] + dp[i-1][j]) % MAX;
      else
        dp[i][j] = dp[i-1][j];
    }
  }

  cout << dp[n][S] << endl;
  return 0;
}
0