結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
|
提出日時 | 2024-09-01 03:23:08 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 5,000 ms |
コード長 | 704 bytes |
コンパイル時間 | 3,220 ms |
コンパイル使用メモリ | 250,636 KB |
実行使用メモリ | 11,776 KB |
最終ジャッジ日時 | 2024-09-01 03:23:12 |
合計ジャッジ時間 | 4,389 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/modint>using namespace std;using namespace atcoder;using ll = long long;using mint = modint1000000007;template<typename T> vector<vector<T>> Partition(int N) {vector<vector<T>> r(N + 1, vector<T>(101, 0));for(int i = 0; i <= 100; i++) { r[0][i] = 1; }for(int i = 1; i <= N; i++) {for(int j = 1; j <= 100; j++) { r[i][j] = r[i][j - 1] + (i - j >= 0 ? r[i - j][j] : 0); }}return r;}int main() {ios::sync_with_stdio(false);cin.tie(nullptr);ll N, S, K;cin >> N >> S >> K;S -= K * N * (N - 1) / 2;if(S < 0) {cout << 0 << "\n";return 0;}auto p = Partition<mint>(S);cout << p[S][N].val() << "\n";}