結果

問題 No.269 見栄っ張りの募金活動
ユーザー omuomu
提出日時 2015-08-22 20:30:05
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,591 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 85,660 KB
実行使用メモリ 11,540 KB
最終ジャッジ日時 2023-09-25 16:14:58
合計ジャッジ時間 12,037 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
11,540 KB
testcase_01 AC 5 ms
11,400 KB
testcase_02 AC 6 ms
11,236 KB
testcase_03 AC 27 ms
11,516 KB
testcase_04 AC 4,504 ms
11,516 KB
testcase_05 AC 6 ms
11,212 KB
testcase_06 AC 6 ms
11,284 KB
testcase_07 TLE -
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 <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

inline bool cheak(ll x, ll y, ll xMax, ll yMax){ return x >= 0 && y >= 0 && xMax > x && yMax > y; }
inline ll toInt(string s) { ll v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
template<class T> inline T sqr(T x) { return x*x; }

#define For(i,a,b)	for(ll (i) = (a);i < (b);(i)++)
#define rep(i,n)	For(i,0,n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define sz(a)		(sizeof(a))

const int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, -1, 0, 1, -1, 1, -1, 1 };
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 2;

int n, s, k;
int dp[101][20001];

int dfs(int m, int v,int tk){
	if (dp[m][v] != -1)return dp[m][v];

	if (m == n){
		if (v == s){
			return 1;
		}else{
			return 0;
		}
	}
	int ret = 0;
	for (int i = tk; v + i * (n - m) <= s; i++){
		ret += dfs(m + 1, v + i * (n - m), k);
		ret %= mod;
	}
	return dp[m][v] = ret;
}

int main(){

	mclr(dp);
	cin >> n >> s >> k;
	cout << dfs(0, 0, 0) << endl;

	return 0;
}
0