結果

問題 No.269 見栄っ張りの募金活動
ユーザー YazatenYazaten
提出日時 2018-07-04 15:22:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4,677 ms / 5,000 ms
コード長 705 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 165,676 KB
実行使用メモリ 19,428 KB
最終ジャッジ日時 2023-09-23 01:30:17
合計ジャッジ時間 18,828 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
19,384 KB
testcase_01 AC 7 ms
19,420 KB
testcase_02 AC 8 ms
19,092 KB
testcase_03 AC 19 ms
19,196 KB
testcase_04 AC 3,305 ms
19,328 KB
testcase_05 AC 8 ms
19,132 KB
testcase_06 AC 7 ms
19,404 KB
testcase_07 AC 4,677 ms
19,428 KB
testcase_08 AC 8 ms
19,180 KB
testcase_09 AC 8 ms
19,092 KB
testcase_10 AC 7 ms
19,196 KB
testcase_11 AC 1,595 ms
19,112 KB
testcase_12 AC 8 ms
19,148 KB
testcase_13 AC 680 ms
19,136 KB
testcase_14 AC 1,360 ms
19,144 KB
testcase_15 AC 973 ms
19,108 KB
testcase_16 AC 7 ms
19,132 KB
testcase_17 AC 7 ms
19,116 KB
testcase_18 AC 991 ms
19,124 KB
testcase_19 AC 324 ms
19,112 KB
testcase_20 AC 249 ms
19,136 KB
testcase_21 AC 1,153 ms
19,088 KB
testcase_22 AC 240 ms
19,092 KB
testcase_23 AC 13 ms
19,120 KB
testcase_24 AC 674 ms
19,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back

const ll MOD = 1e9+7;
signed main(){
    int n,s,k;
    cin>>n>>s>>k;
    
    s -= n*(n-1)/2*k;
    
    static int dp[101][20001];
    rep(i,101)rep(j,20001)dp[i][j] = 0;
    dp[0][0] = 1;
    
    for(int i=1;i<=n;i++){
        for(int j=0;j<=s;j++){
            for(int value=0;;value++){
                int remain = n-i+1;
                if(j-remain*value<0)break;
                (dp[i][j] += dp[i-1][j-remain*value])%=MOD;
            }
        }
    }
    cout<<dp[n][s]<<endl;
}
0