結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2018-12-26 23:38:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 5,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 1,694 ms |
コンパイル使用メモリ | 167,964 KB |
実行使用メモリ | 19,092 KB |
最終ジャッジ日時 | 2024-10-01 14:48:38 |
合計ジャッジ時間 | 2,678 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef double D;typedef pair<ll,ll> P;#define M 1000000007#define F first#define S second#define PB push_back#define INF 100000000000000000ll n,s,k,dp[105][20005];int main(void){cin>>n>>s>>k;ll p=n*(n-1)/2*k;if(s<p){cout<<0<<endl;return 0;}s-=p;dp[0][0]=1;for(ll i=1;i<=n;i++){ll o=n-i+1;for(ll j=0;j<o;j++)dp[i][j]=dp[i-1][j];for(ll j=o;j<=s;j++)dp[i][j]=(dp[i-1][j]+dp[i][j-o])%M;}cout<<dp[n][s]<<endl;}