結果
問題 |
No.1532 Different Products
|
ユーザー |
![]() |
提出日時 | 2021-06-04 21:34:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3,619 ms / 4,000 ms |
コード長 | 290 bytes |
コンパイル時間 | 1,938 ms |
コンパイル使用メモリ | 202,168 KB |
最終ジャッジ日時 | 2025-01-22 00:07:39 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 62 |
コンパイルメッセージ
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";} | ^~~~
ソースコード
#include<bits/stdc++.h> using namespace std; using l=long long; vector<unordered_map<l,l>> m; l f(l 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";}