結果

問題 No.269 見栄っ張りの募金活動
ユーザー h_nosonh_noson
提出日時 2016-04-15 09:32:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 8 ms / 5,000 ms
コード長 634 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 62,612 KB
実行使用メモリ 11,272 KB
最終ジャッジ日時 2023-09-23 01:18:34
合計ジャッジ時間 1,550 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
11,144 KB
testcase_01 AC 4 ms
11,128 KB
testcase_02 AC 4 ms
11,268 KB
testcase_03 AC 5 ms
11,156 KB
testcase_04 AC 6 ms
11,272 KB
testcase_05 AC 4 ms
11,140 KB
testcase_06 AC 4 ms
11,120 KB
testcase_07 AC 8 ms
11,268 KB
testcase_08 AC 5 ms
11,164 KB
testcase_09 AC 4 ms
11,160 KB
testcase_10 AC 4 ms
11,224 KB
testcase_11 AC 5 ms
11,148 KB
testcase_12 AC 5 ms
11,224 KB
testcase_13 AC 5 ms
11,196 KB
testcase_14 AC 5 ms
11,164 KB
testcase_15 AC 5 ms
11,268 KB
testcase_16 AC 4 ms
11,132 KB
testcase_17 AC 4 ms
11,220 KB
testcase_18 AC 6 ms
11,192 KB
testcase_19 AC 5 ms
11,224 KB
testcase_20 AC 4 ms
11,220 KB
testcase_21 AC 5 ms
11,132 KB
testcase_22 AC 4 ms
11,144 KB
testcase_23 AC 4 ms
11,128 KB
testcase_24 AC 5 ms
11,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 100000000
#define MOD 1000000007

typedef long long ll;

int main() {
    int i, j, n, s, k;
    int dp[100][20001] {};
    cin >> n >> s >> k;
    s -= n * (n-1) * k / 2;
    rep (i,s/n+1)
        dp[0][i*n] = 1;
    REP (i,1,n) {
        rep (j,s+1) {
            dp[i][j] = (dp[i-1][j] + (n-i <= j ? dp[i][j-(n-i)] : 0)) % MOD;
        }
    }
    cout << dp[n-1][s] << endl;
    return 0;
}
0