結果
問題 | No.1532 Different Products |
ユーザー |
|
提出日時 | 2021-06-04 20:39:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2,954 ms / 4,000 ms |
コード長 | 611 bytes |
コンパイル時間 | 935 ms |
コンパイル使用メモリ | 81,252 KB |
最終ジャッジ日時 | 2025-01-21 22:21:34 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 62 |
ソースコード
#include <iostream> #include <map> using namespace std; using lint = unsigned long long; void solve() { lint n; cin >> n; map<lint, lint> dp; { lint k; cin >> k; dp[k] = 1; } for (lint x = 1; x <= n; ++x) { map<lint, lint> ndp = dp; for (auto [k, p] : dp) { if (k < x) continue; ndp[k / x] += p; } swap(dp, ndp); } lint ans = -1; for (auto [k, p] : dp) ans += p; cout << ans << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }