結果

問題 No.269 見栄っ張りの募金活動
ユーザー tsutajtsutaj
提出日時 2017-07-04 10:50:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 963 bytes
コンパイル時間 1,619 ms
コンパイル使用メモリ 164,980 KB
実行使用メモリ 18,976 KB
最終ジャッジ日時 2023-09-23 01:23:23
合計ジャッジ時間 2,536 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,636 KB
testcase_04 AC 11 ms
9,284 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 26 ms
18,976 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 12 ms
10,860 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 4 ms
4,964 KB
testcase_12 AC 10 ms
9,156 KB
testcase_13 AC 5 ms
5,568 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 5 ms
5,244 KB
testcase_16 AC 9 ms
8,620 KB
testcase_17 AC 3 ms
4,732 KB
testcase_18 AC 17 ms
13,284 KB
testcase_19 AC 6 ms
5,996 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 4 ms
4,576 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 基本テンプレート (縮小版)

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
typedef pair<int, int> pii;
typedef long long ll;
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N, S, K;
int dp[101][20001];

signed main() {
    dp[1][0] = 1;
    cin >> N >> S >> K;
    rep(i,0,N) repq(j,0,S) {
        if((N-i) * K <= j) (dp[i+1][j] += dp[i][j-(N-i)*K]) %= MOD;
        if(N-i <= j) (dp[i+1][j] += dp[i+1][j-(N-i)]) %= MOD;
        // if(dp[i+1][j] != 0) printf("debug: dp[%lld][%lld] = %lld\n", i+1, j, dp[i+1][j]);
    }
    cout << dp[N][S] << endl;
    return 0;
}
0