結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー | miscellllllaneous |
提出日時 | 2021-04-24 17:52:48 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 9 ms / 5,000 ms |
コード長 | 1,775 bytes |
コンパイル時間 | 1,552 ms |
コンパイル使用メモリ | 164,196 KB |
実行使用メモリ | 11,420 KB |
最終ジャッジ日時 | 2023-09-17 13:42:18 |
合計ジャッジ時間 | 3,061 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
9,716 KB |
testcase_01 | AC | 3 ms
9,772 KB |
testcase_02 | AC | 3 ms
9,804 KB |
testcase_03 | AC | 4 ms
10,008 KB |
testcase_04 | AC | 6 ms
10,084 KB |
testcase_05 | AC | 3 ms
7,912 KB |
testcase_06 | AC | 3 ms
9,716 KB |
testcase_07 | AC | 9 ms
11,420 KB |
testcase_08 | AC | 3 ms
8,104 KB |
testcase_09 | AC | 6 ms
10,432 KB |
testcase_10 | AC | 3 ms
8,076 KB |
testcase_11 | AC | 4 ms
10,476 KB |
testcase_12 | AC | 5 ms
9,056 KB |
testcase_13 | AC | 4 ms
9,896 KB |
testcase_14 | AC | 3 ms
9,868 KB |
testcase_15 | AC | 4 ms
8,728 KB |
testcase_16 | AC | 5 ms
9,920 KB |
testcase_17 | AC | 4 ms
9,840 KB |
testcase_18 | AC | 7 ms
10,376 KB |
testcase_19 | AC | 4 ms
9,760 KB |
testcase_20 | AC | 3 ms
9,860 KB |
testcase_21 | AC | 3 ms
8,152 KB |
testcase_22 | AC | 3 ms
9,828 KB |
testcase_23 | AC | 3 ms
9,780 KB |
testcase_24 | AC | 3 ms
8,232 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <ll, ll> P; #define rep(i,n) for ( int i =0 ; i < (n); i ++) #define ALL(x) x.begin(),x.end() template<class T> bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;} template<class T> bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;} const int INF = (1<<30)-1; const ll LINF = 1e18; const int mod = 1000000007; #define LOCAL #ifdef LOCAL #define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl #define vdbg(x) cerr << __LINE__ << " : " << #x << " = "; copy((x).begin(), (x).end(), ostream_iterator<ll>(cerr, "; ")); cerr << endl; #define vvdbg(x) cerr << __LINE__ << " : " << #x << " = " << endl; for ( auto i: (x) ){ copy((i).begin(), (i).end(), ostream_iterator<ll>(cerr, "; ")); cerr << endl;} #define pdbg(x) cerr << __LINE__ << " : " << #x << " = " ; for ( auto i: (x) ) cerr <<'(' << i.first<< ' ' << i.second << ')'<< ", "; cerr << endl; #define vpdbg(x) cerr << __LINE__ << " : " << #x << " = " << endl ; for (auto j:(x) ) {for ( auto i: (j) ) cerr << '(' << i.first<< ' ' << i.second << ')'<< ", "; cerr << endl;} #else #define dbg(x) true #define vdbg(x) true #define vvdbg(x) true #define pdbg(x) true #define vpdbg(x) true #endif int main() { //入力 int n,s,k; scanf("%d %d %d",&n, &s, &k); int dp[101][20001]; // dpを作っていく rep(i,20001) dp[0][i] = 0; rep(i, 101)dp[i][0] = 1; rep(i,n)rep(j,s){ dp[i+1][j+1] =dp[i][j+1]; if ( j-i >=0) dp[i+1][j+1] += dp[i+1][j-i] % mod; dp[i+1][j+1] %= mod; } if (s - (n-1) * n /2 *k < 0) { cout << 0 << endl; return 0; } cout << dp[n][s - (n-1) * n /2 *k] << endl; // rep(i,10){ // rep(j,10) cout << dp[i][j] << ' '; // cout << endl; // } }