結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー | akusyounin2412 |
提出日時 | 2018-07-18 11:31:33 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 82 ms / 5,000 ms |
コード長 | 2,115 bytes |
コンパイル時間 | 1,298 ms |
コンパイル使用メモリ | 122,816 KB |
実行使用メモリ | 62,436 KB |
最終ジャッジ日時 | 2024-07-16 02:06:38 |
合計ジャッジ時間 | 2,643 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 12 ms
30,172 KB |
testcase_01 | AC | 12 ms
29,228 KB |
testcase_02 | AC | 12 ms
31,288 KB |
testcase_03 | AC | 15 ms
33,236 KB |
testcase_04 | AC | 44 ms
60,600 KB |
testcase_05 | AC | 11 ms
29,468 KB |
testcase_06 | AC | 12 ms
29,020 KB |
testcase_07 | AC | 82 ms
62,436 KB |
testcase_08 | AC | 12 ms
29,124 KB |
testcase_09 | AC | 19 ms
43,780 KB |
testcase_10 | AC | 12 ms
29,832 KB |
testcase_11 | AC | 24 ms
62,264 KB |
testcase_12 | AC | 16 ms
41,628 KB |
testcase_13 | AC | 22 ms
44,312 KB |
testcase_14 | AC | 21 ms
60,932 KB |
testcase_15 | AC | 23 ms
49,020 KB |
testcase_16 | AC | 19 ms
44,388 KB |
testcase_17 | AC | 13 ms
33,728 KB |
testcase_18 | AC | 44 ms
56,752 KB |
testcase_19 | AC | 22 ms
44,072 KB |
testcase_20 | AC | 15 ms
41,740 KB |
testcase_21 | AC | 19 ms
57,080 KB |
testcase_22 | AC | 18 ms
38,836 KB |
testcase_23 | AC | 13 ms
31,388 KB |
testcase_24 | AC | 18 ms
45,984 KB |
ソースコード
# 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; }