結果

問題 No.269 見栄っ張りの募金活動
ユーザー サム
提出日時 2020-11-24 16:22:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 871 bytes
コンパイル時間 1,650 ms
コンパイル使用メモリ 166,292 KB
実行使用メモリ 19,968 KB
最終ジャッジ日時 2024-07-23 18:41:08
合計ジャッジ時間 3,293 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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