結果
| 問題 | No.2846 Birthday Cake |
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2024-08-24 13:28:18 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 801 bytes |
| 記録 | |
| コンパイル時間 | 1,049 ms |
| コンパイル使用メモリ | 216,936 KB |
| 実行使用メモリ | 16,256 KB |
| 最終ジャッジ日時 | 2026-07-05 12:38:32 |
| 合計ジャッジ時間 | 4,034 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using ll = std::int64_t;
int main(){
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int K, N;
std::cin >> K >> N;
const int EXCEPTIONS = (1 << 13) | (1 << 17) | (1 << 19) | (1 << 23);
const int MAX_DEN = 55440;
std::vector dp(K + 1, std::vector<ll>(MAX_DEN + 1, 0));
dp[0][0] = 1;
for(int i=0;i<K;i++){
for(int j=0;j<=MAX_DEN;j++){
for(int k=1;k<=N;k++){
if(EXCEPTIONS >> k & 1){continue;}
int num = MAX_DEN / k;
if(j + num <= MAX_DEN){
dp[i + 1][j + num] += dp[i][j];
}
}
}
}
ll res = dp[K][MAX_DEN];
if(EXCEPTIONS >> K & 1){
res += 1;
}
std::cout << res << std::endl;
}
tottoripaper