結果

問題 No.269 見栄っ張りの募金活動
ユーザー Yang33Yang33
提出日時 2016-10-21 17:05:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 997 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 73,284 KB
実行使用メモリ 11,532 KB
最終ジャッジ日時 2023-09-23 01:21:48
合計ジャッジ時間 1,682 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
11,272 KB
testcase_01 AC 4 ms
11,244 KB
testcase_02 AC 5 ms
11,252 KB
testcase_03 AC 5 ms
11,252 KB
testcase_04 AC 6 ms
11,244 KB
testcase_05 AC 4 ms
11,268 KB
testcase_06 AC 5 ms
11,240 KB
testcase_07 AC 9 ms
11,312 KB
testcase_08 AC 4 ms
11,276 KB
testcase_09 AC 7 ms
11,312 KB
testcase_10 AC 4 ms
11,256 KB
testcase_11 AC 5 ms
11,260 KB
testcase_12 AC 6 ms
11,224 KB
testcase_13 AC 5 ms
11,256 KB
testcase_14 AC 5 ms
11,244 KB
testcase_15 AC 5 ms
11,372 KB
testcase_16 AC 6 ms
11,368 KB
testcase_17 AC 4 ms
11,260 KB
testcase_18 AC 7 ms
11,328 KB
testcase_19 AC 6 ms
11,272 KB
testcase_20 AC 5 ms
11,236 KB
testcase_21 AC 4 ms
11,532 KB
testcase_22 AC 5 ms
11,356 KB
testcase_23 AC 5 ms
11,272 KB
testcase_24 AC 5 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX


using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(int (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define llong long long
#define debug(x) cout<<#x<<": "<<x<<endl

llong n;


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int s, k;
    cin >> n >> s >> k;
    int dp[101][20011] = { 0 };

    for (int i = 0; i < 20010; i += n) {
        dp[0][i] = 1;
    }

    FOR(i, 0, n - 1) {
        FOR(j, 0, s + 1) {
            if (0 <= j - k*(n - 1 - i))
                dp[i + 1][j] += dp[i][j - k*(n - 1 - i)];
            if (0 <= j - (n - 1 - i))
                dp[i + 1][j] += dp[i + 1][j - (n - 1 - i)];
            dp[i + 1][j] %= MOD;
        }
    }

    cout << dp[n - 1][s] << endl;

    return 0;
}
0