結果

問題 No.1532 Different Products
ユーザー opt
提出日時 2021-06-05 11:23:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 641 ms / 4,000 ms
コード長 483 bytes
コンパイル時間 2,329 ms
コンパイル使用メモリ 202,216 KB
最終ジャッジ日時 2025-01-22 03:31:39
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep_(i, a_, b_, a, b, ...) for (int i = (a), lim##i = (b); i < lim##i; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
using ll = long long;

int main() {
  ll n, k; cin >> n >> k;
  unordered_map<ll, ll> dp;
  dp[k] = 1;
  for (; n; --n)
    for (auto [x, y] : unordered_map<ll, ll>(dp))
      if (x >= n) dp[x/n] += y;
  ll ans = -1;
  for (auto [x, y] : dp) if (x) ans += y;
  cout << ans << '\n';
}
0