結果

問題 No.1532 Different Products
ユーザー だれだれ
提出日時 2021-06-04 21:37:19
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 291 bytes
コンパイル時間 17,350 ms
コンパイル使用メモリ 261,928 KB
最終ジャッジ日時 2025-01-22 00:21:42
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26 TLE * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main(){l n,k;cin>>n>>k;m.resize(n+1);cout<<f(n,k)-1<<"\n";}
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using l=long long;
vector<unordered_map<int,l>> m;
l f(int n,l k){
  if (m[n][k])return m[n][k];
  if (k==0)return 0;
  if (n==1)return m[n][k]=2;
  return m[n][k]=f(n-1,k)+f(n-1,k/n);
}
main(){l n,k;cin>>n>>k;m.resize(n+1);cout<<f(n,k)-1<<"\n";}
0