結果
問題 |
No.2846 Birthday Cake
|
ユーザー |
![]() |
提出日時 | 2024-07-15 18:54:11 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 830 ms |
コンパイル使用メモリ | 90,096 KB |
実行使用メモリ | 201,600 KB |
最終ジャッジ日時 | 2024-07-15 23:23:07 |
合計ジャッジ時間 | 6,151 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 2 RE * 10 TLE * 1 -- * 21 |
ソースコード
#include <iostream> #include <vector> #include <numeric> using namespace std; // TLE, MLE, RE想定 int main(){ int k, n; cin >> k >> n; long long l = 1; for (long long i = 2; i <= n; i++){ l = lcm(l, i); } vector<long long> dp(l + 1); dp[0] = 1; for (int i = 0; i < k; i++){ vector<long long> ndp(l + 1); for (int j = 0; j <= l; j++){ for (int x = 1; x <= n; x++){ int cake = l / x; if (j + cake <= l) ndp[j + cake] += dp[j]; } } swap(dp, ndp); } cout << dp[l] << endl; }