結果
| 問題 | No.1532 Different Products |
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-08-14 16:36:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 455 bytes |
| コンパイル時間 | 1,587 ms |
| コンパイル使用メモリ | 178,792 KB |
| 実行使用メモリ | 110,976 KB |
| 最終ジャッジ日時 | 2024-10-05 12:23:38 |
| 合計ジャッジ時間 | 12,403 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 TLE * 1 -- * 51 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
map<vector<long long>,long long> m;
long long calc(long long N,long long K){
if(m.count({N,K})){
return m[{N,K}];
}
if(N==1){
return 1;
}
if(N<=K){
m[{N,K}]=calc(N-1,K/N)+1+calc(N-1,K);
return m[{N,K}];
}else{
m[{N,K}]=calc(N-1,K);
return m[{N,K}];
}
}
int main(){
long long N,K;
cin>>N>>K;
cout<<calc(N,K)<<endl;;
}
ytft