結果

問題 No.1532 Different Products
ユーザー shakayamishakayami
提出日時 2021-06-04 20:46:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 2,087 ms
コンパイル使用メモリ 200,048 KB
最終ジャッジ日時 2025-01-21 22:30:16
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
map<int,ull> memo[210];
ull solve(int N,int K){
    if (memo[N].find(K)!=memo[N].end()){
        return memo[N][K];
    }
    if (N==1){
        if (K==0){
            return 0ull;
        }
        else{
            return 2ull;
        }
    }
    ull res=solve(N-1,K)+solve(N-1,K/N);
    memo[N][K]=res;
    return res;
}
int main(void){
    int N,K;
    cin>>N>>K;
    cout<<solve(N,K)-1<<endl;
}
0