結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
sugarrr
|
| 提出日時 | 2018-03-10 11:47:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 986 bytes |
| コンパイル時間 | 695 ms |
| コンパイル使用メモリ | 79,156 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2024-10-13 05:13:52 |
| 合計ジャッジ時間 | 19,516 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 TLE * 1 |
ソースコード
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005
ll mod(ll a){
ll c=a%i_7;
if(c>=0)return c;
else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/
#define rep(i,l,r) for(int i=l;i<=r;i++)
const double EPS=1E-8;
////////////////////////////////////////
int main() {
int n,s,k;cin>>n>>s>>k;
s-=k*(n-1)*n/2;
if(s<0){
cout<<0<<endl;return 0;
}
//sをn個に分ける
ll dp[n+1][s+1];memset(dp,0,sizeof(dp));dp[0][0]=1;
rep(i,1,n){
rep(j,0,s){
for(int k=0;j-k*(n-i+1)>=0;k++){
dp[i][j]=mod(dp[i][j]+dp[i-1][j-k*(n-i+1)]);
}
}
}
cout<<dp[n][s];
return 0;
}
sugarrr