結果

問題 No.269 見栄っ張りの募金活動
ユーザー roiti46roiti46
提出日時 2015-10-11 00:12:16
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 764 bytes
コンパイル時間 2,711 ms
コンパイル使用メモリ 144,532 KB
実行使用メモリ 19,044 KB
最終ジャッジ日時 2023-08-20 21:43:03
合計ジャッジ時間 2,526 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 4 ms
4,652 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 27 ms
19,044 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 13 ms
10,648 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 4 ms
4,908 KB
testcase_12 AC 11 ms
9,000 KB
testcase_13 AC 5 ms
5,656 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 5 ms
5,300 KB
testcase_16 AC 10 ms
8,492 KB
testcase_17 AC 4 ms
4,444 KB
testcase_18 AC 18 ms
13,400 KB
testcase_19 AC 6 ms
5,988 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,656 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (__typeof(a.begin()) x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define ISIN(a, x) (a.find(x) != a.end())

int N, S, K;
const ll mod = 1000000007;
ll dp[105][20005];

int main(void) {
  cin >> N >> S >> K;
  for (int i = 0; i < S + N; i += N) dp[1][i] = 1;
  REP(i, 2, N + 1) {
    int m = N + 1 - i;
    rep(j, S + 1) {
      if (j >= K * m) dp[i][j] = (dp[i][j] + dp[i - 1][j - K * m]) % mod;
      if (j >= m)     dp[i][j] = (dp[i][j] + dp[i][j - m]) % mod;
    }
  }

  cout << dp[N][S] << endl;

  return 0;
}
0