結果

問題 No.1532 Different Products
ユーザー opt
提出日時 2021-06-04 23:29:56
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 3,683 ms / 4,000 ms
コード長 333 bytes
コンパイル時間 7,506 ms
コンパイル使用メモリ 260,688 KB
最終ジャッジ日時 2025-01-22 03:19:08
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using ll = long long;

std::unordered_map<ll, ll> memo[202];
ll dp(int n, ll k) {
  if (k == 0) return 0;
  if (n == 0) return 1;
  if (memo[n].count(k)) return memo[n][k];
  return memo[n][k] = dp(n-1, k) + dp(n-1, k/n);
}

int main() {
  ll n, k; std::cin >> n >> k;
  std::cout << (dp(n, k) - 1) << '\n';
}
0