結果
問題 | No.1532 Different Products |
ユーザー |
|
提出日時 | 2021-06-05 15:20:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,136 ms / 4,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 1,708 ms |
コンパイル使用メモリ | 176,896 KB |
実行使用メモリ | 14,464 KB |
最終ジャッジ日時 | 2024-11-21 13:13:30 |
合計ジャッジ時間 | 38,330 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 62 |
ソースコード
#include <bits/stdc++.h> using namespace std ; typedef long long ll ; #define rep(i,n) for(int i = 0 ; i < n ; i++) #define rrep(i,a,b) for(int i = a ; i < b ; i++) int main() { ll n, k ; cin >> n >> k ; map<ll, ll> dp ; dp[k] = 1 ; for(int i = n ; i > 0 ; i--) for (auto it : map<ll, ll>(dp)){ ll x = it.first , y = it.second ; if (x >= i) dp[x/i] += y ; } ll ans = -1 ; for (auto it : dp){ ll x = it.first , y = it.second ; if (x) ans += y ; } cout << ans << endl ; }