結果

問題 No.269 見栄っ張りの募金活動
ユーザー nemakura3nemakura3
提出日時 2019-10-04 19:17:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 844 bytes
コンパイル時間 1,606 ms
コンパイル使用メモリ 164,060 KB
実行使用メモリ 11,200 KB
最終ジャッジ日時 2024-04-14 09:59:21
合計ジャッジ時間 2,797 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 3 ms
7,752 KB
testcase_04 WA -
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 3 ms
9,820 KB
testcase_07 RE -
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 5 ms
9,356 KB
testcase_19 AC 3 ms
6,956 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 WA -
testcase_22 AC 3 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define sz(x) (x).size()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF = 1e9;
const ll LINF = 1LL<<60;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll n,s,k,dp[101][10000];

int main() {
  cin>>n>>s>>k;
  ll ks = 0;
  rep(i,n) ks += k*i;
  if (ks > s) {
    cout << 0 << '\n';
    return 0;
  }
  ll r = s-ks;
  dp[0][0] = 1;
  REP(i,1,n+1) {
    rep(j,r+1) {
      if (j-i >= 0) dp[i][j] = (dp[i][j-i]+dp[i-1][j])%MOD;
      else dp[i][j] = dp[i-1][j];
    }
  }
  cout << dp[n][r] << '\n';
  return 0;
}
0