結果

問題 No.269 見栄っ張りの募金活動
ユーザー サムサム
提出日時 2020-11-24 16:22:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 871 bytes
コンパイル時間 1,580 ms
コンパイル使用メモリ 164,248 KB
実行使用メモリ 19,948 KB
最終ジャッジ日時 2023-10-01 01:05:52
合計ジャッジ時間 3,807 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
19,748 KB
testcase_01 AC 40 ms
19,748 KB
testcase_02 AC 40 ms
19,748 KB
testcase_03 AC 40 ms
19,812 KB
testcase_04 AC 40 ms
19,812 KB
testcase_05 AC 38 ms
19,816 KB
testcase_06 AC 39 ms
19,820 KB
testcase_07 AC 39 ms
19,812 KB
testcase_08 AC 39 ms
19,804 KB
testcase_09 AC 40 ms
19,760 KB
testcase_10 AC 40 ms
19,888 KB
testcase_11 AC 38 ms
19,756 KB
testcase_12 AC 39 ms
19,804 KB
testcase_13 AC 38 ms
19,800 KB
testcase_14 AC 38 ms
19,744 KB
testcase_15 AC 38 ms
19,816 KB
testcase_16 AC 39 ms
19,824 KB
testcase_17 AC 38 ms
19,948 KB
testcase_18 AC 40 ms
19,812 KB
testcase_19 AC 39 ms
19,892 KB
testcase_20 AC 39 ms
19,756 KB
testcase_21 AC 39 ms
19,896 KB
testcase_22 AC 39 ms
19,824 KB
testcase_23 AC 39 ms
19,740 KB
testcase_24 AC 39 ms
19,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 20005
#define INF 1000000005
#define INFLL (long long)1e18
#define PI 3.1415926535897
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = (1<<20);
const int MOD = 1000000007; 
ll dp[N][105];
void make_sep(int n,int m){
    dp[0][0]=1;
    for(int i=1;i<=m;i++){
        for(int j=0;j<=n;j++){
            dp[j][i]=dp[j][i-1];
            if(j-i>=0)dp[j][i]+=dp[j-i][i];
            dp[j][i]%=MOD;
        }
    }
}
void solve(){
    int n,s,k;
    cin>>n>>s>>k;
    make_sep(N-1,102);
    int ans=0;
    if(s-(n-1)*k*n/2>=0)ans=dp[s-(n-1)*k*n/2][n];
    OUT(ans);
}
int main(){
    solve();
    return 0;
}
0