結果

問題 No.269 見栄っ張りの募金活動
ユーザー bamboo_circlebamboo_circle
提出日時 2019-10-29 12:34:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 464 bytes
コンパイル時間 1,483 ms
コンパイル使用メモリ 163,820 KB
実行使用メモリ 118,264 KB
最終ジャッジ日時 2023-10-12 23:19:24
合計ジャッジ時間 3,122 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,356 KB
testcase_01 AC 2 ms
5,436 KB
testcase_02 AC 7 ms
32,056 KB
testcase_03 AC 22 ms
87,392 KB
testcase_04 AC 15 ms
60,972 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 25 ms
31,952 KB
testcase_08 AC 3 ms
9,520 KB
testcase_09 AC 29 ms
118,264 KB
testcase_10 AC 4 ms
15,608 KB
testcase_11 AC 5 ms
16,016 KB
testcase_12 AC 26 ms
117,304 KB
testcase_13 AC 10 ms
42,376 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 7 ms
30,120 KB
testcase_16 AC 22 ms
99,720 KB
testcase_17 AC 16 ms
72,996 KB
testcase_18 AC 26 ms
114,248 KB
testcase_19 AC 13 ms
54,664 KB
testcase_20 AC 3 ms
9,644 KB
testcase_21 AC 3 ms
5,696 KB
testcase_22 AC 9 ms
40,316 KB
testcase_23 AC 8 ms
32,004 KB
testcase_24 AC 3 ms
9,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
const int MOD = 1000000007;

long long dp[101][200001];

int main(){
    int n,s,k;
    cin >> n >> s >> k;

    for(int i = 0; i <= s; i++){
        if(i%n == 0) dp[0][i] = 1;
    }
    for(int i = 1; i < n; i++){
        for(int j = 0; j <= s; j++){
            if(j-k*(n-i) < 0) dp[i][j] = 0;
            else dp[i][j] = (dp[i-1][j-k*(n-i)] + dp[i][j-(n-i)]) % MOD;
        }
    }
    cout << dp[n-1][s] << endl;
}
0