結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-29 23:27:17 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 5,000 ms |
| コード長 | 1,036 bytes |
| コンパイル時間 | 1,423 ms |
| コンパイル使用メモリ | 154,420 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-11-30 18:55:20 |
| 合計ジャッジ時間 | 2,368 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>
#include <stdio.h>
using ll = long long;
using namespace std;
const int M = 1e9 + 7;
int main() {
ios::sync_with_stdio(false);
int n, s, k;
cin >> n >> s >> k;
int st = k * n * (n - 1) / 2;
vector<vector<int>> dp(n + 1, vector<int>(s + 1));
dp[0][0] = 1;
if (st > s) {
cout << 0 << endl;
} else {
s -= st;
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= s; j++) {
if (j - i >= 0)
dp[i][j] = (dp[i][j - i] + dp[i - 1][j]) % M;
else
dp[i][j] = dp[i - 1][j];
}
}
cout << dp[n][s] << endl;
}
return 0;
}