結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2018-09-30 11:43:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 654 bytes |
| コンパイル時間 | 656 ms |
| コンパイル使用メモリ | 85,444 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-16 02:08:18 |
| 合計ジャッジ時間 | 1,510 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<ll, int> Pl;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int main()
{
int n, s, k;
cin>>n>>s>>k;
s-=(n*(n-1)/2*k);
if(s<0){
cout<<0<<endl; return 0;
}
ll dp[20001];
fill(dp, dp+s+1, 0);
dp[0]=1;
for(int i=1; i<=n; i++){
for(int j=0; j<=s-i; j++){
dp[j+i]+=dp[j];
dp[j+i]%=MOD;
}
}
cout<<dp[s]<<endl;
return 0;
}
chocorusk