結果

問題 No.269 見栄っ張りの募金活動
ユーザー akusyounin2412akusyounin2412
提出日時 2018-07-18 11:31:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 2,115 bytes
コンパイル時間 1,171 ms
コンパイル使用メモリ 122,816 KB
実行使用メモリ 63,680 KB
最終ジャッジ日時 2023-09-23 01:32:30
合計ジャッジ時間 2,763 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
29,980 KB
testcase_01 AC 11 ms
30,012 KB
testcase_02 AC 12 ms
32,308 KB
testcase_03 AC 14 ms
34,104 KB
testcase_04 AC 47 ms
63,656 KB
testcase_05 AC 12 ms
32,228 KB
testcase_06 AC 12 ms
29,980 KB
testcase_07 AC 88 ms
63,680 KB
testcase_08 AC 12 ms
32,032 KB
testcase_09 AC 19 ms
44,352 KB
testcase_10 AC 12 ms
32,308 KB
testcase_11 AC 25 ms
63,552 KB
testcase_12 AC 16 ms
42,300 KB
testcase_13 AC 22 ms
46,776 KB
testcase_14 AC 20 ms
63,680 KB
testcase_15 AC 23 ms
48,936 KB
testcase_16 AC 19 ms
46,384 KB
testcase_17 AC 12 ms
34,260 KB
testcase_18 AC 46 ms
59,116 KB
testcase_19 AC 22 ms
46,608 KB
testcase_20 AC 15 ms
42,696 KB
testcase_21 AC 19 ms
57,436 KB
testcase_22 AC 18 ms
40,456 KB
testcase_23 AC 12 ms
32,120 KB
testcase_24 AC 17 ms
48,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum[2000000], ans, dp[200000][200];
Pll a[2000000],b[2000000];
string str,ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ -1,0 } ,{ 0,-1 } };
struct Edge { LL to, cost; };
vector<Edge>vec[1000000];
vector<Pll>v;
map<string, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
LL partf(LL n, LL k) {
	if (k == 0 && n == 0)return 1;
	if (k <= 0 || n < 0)return 0;
	//dp=-1で初期化
	if (dp[n][k] != -1)return dp[n][k];
	dp[n][k] = partf(n - s * (k - 1), k - 1) + partf(n - k, k);
	dp[n][k] %= MOD;
	return dp[n][k];
}
int main() {
	cin >> n >> m >> s;
	rep(i,m+1)
		rep(j, n+1) {
		dp[i][j] = -1;
	}
	cout << partf(m,n) << endl;
	return 0;
}
0