結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
latte0119
|
| 提出日時 | 2015-10-31 19:54:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 748 bytes |
| コンパイル時間 | 450 ms |
| コンパイル使用メモリ | 59,152 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-16 01:50:28 |
| 合計ジャッジ時間 | 1,137 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cassert>
#include<cstring>
using namespace std;
typedef pair<int,int>pint;
typedef vector<int>vint;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}
const int mod=1000000007;
int dp[20001];
int N,S,K;
int main(){
cin>>N>>S>>K;
S-=K*N*(N-1)/2;
if(S<0){
cout<<0<<endl;
return 0;
}
dp[0]=1;
rep(i,N){
int tmp=N-i;
for(int j=0;j+tmp<=S;j++){
dp[j+tmp]+=dp[j];
dp[j+tmp]%=mod;
}
}
cout<<dp[S]<<endl;
return 0;
}
latte0119