結果

問題 No.269 見栄っ張りの募金活動
ユーザー Hoi_koroHoi_koro
提出日時 2016-12-15 01:45:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3,814 ms / 5,000 ms
コード長 1,428 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 116,108 KB
実行使用メモリ 19,352 KB
最終ジャッジ日時 2023-09-23 01:23:46
合計ジャッジ時間 19,070 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 7 ms
4,376 KB
testcase_03 AC 55 ms
4,380 KB
testcase_04 AC 2,925 ms
9,516 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 3,814 ms
19,352 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 741 ms
10,212 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1,690 ms
4,876 KB
testcase_12 AC 544 ms
8,532 KB
testcase_13 AC 583 ms
5,096 KB
testcase_14 AC 455 ms
4,380 KB
testcase_15 AC 807 ms
4,956 KB
testcase_16 AC 825 ms
8,080 KB
testcase_17 AC 50 ms
4,380 KB
testcase_18 AC 2,577 ms
13,028 KB
testcase_19 AC 599 ms
5,732 KB
testcase_20 AC 182 ms
4,376 KB
testcase_21 AC 532 ms
4,376 KB
testcase_22 AC 195 ms
4,376 KB
testcase_23 AC 12 ms
4,380 KB
testcase_24 AC 402 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define dump(a) cerr<<#a <<' '<< a <<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n,s,k;
    cin >> n >> s >> k;
    vector<vector<LL>> dp(n+1,VLL(s+1));
    dp[0][0]=1;
    fill(ALL(dp[1]),1);
    FOR(i,2,n+1){
        if(k==0)dp[i][0]=1;
        FOR(j,1,s+1){
            for(int h=0; j-i*h-k*(i-1)>=0 ;++h){
                dp[i][j]=(dp[i][j]+dp[i-1][j-i*h-k*(i-1)])%MOD;
            }
        }
    }
    cout<< dp[n][s]<<endl;

    return 0;
}
0