結果

問題 No.269 見栄っ張りの募金活動
ユーザー mint6421mint6421
提出日時 2019-12-02 22:21:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,259 bytes
コンパイル時間 1,466 ms
コンパイル使用メモリ 164,900 KB
実行使用メモリ 25,596 KB
最終ジャッジ日時 2023-08-16 11:04:13
合計ジャッジ時間 8,280 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
21,340 KB
testcase_01 AC 8 ms
21,512 KB
testcase_02 AC 8 ms
21,648 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #


#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}

int n,s,k;
int dp[110][21000];


int dfs(int m,int y){
  if(y<0) return 0;
  if(m==n-1) return 1;
  if(dp[m][y]>=0) return dp[m][y];

  int ret=0;
  for(int i=0;i*(n-m)<=y;i++){
    ret+=dfs(m+1,y-i*(n-m));
    ret%=M;
  }

  return ret;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  memset(dp,-1,sizeof(dp));
  cin>>n>>s>>k;
  s-=n*(n-1)/2*k;
  cout<<dfs(0,s)<<endl;


}
0