8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 640e385 commit edc20f7Copy full SHA for edc20f7
0x15/solutions/1351.cpp
@@ -1,11 +1,30 @@
1
-// Authored by : BaaaaaaaaaaarkingDog
+// Authored by : scsc3204
2
// Co-authored by : -
3
-// http://boj.kr/****************
+// http://boj.kr/e81859b0268548ffad93a45b285dab49
4
#include <bits/stdc++.h>
5
using namespace std;
6
+typedef long long ll;
7
+
8
+ll n;
9
+int p, q;
10
+unordered_map<ll, ll> um;
11
12
+ll solve(ll x) {
13
+ if(x == 0) return 1;
14
+ if(um[x]) return um[x];
15
16
+ um[x] = solve(x/p) + solve(x/q);
17
+ return um[x];
18
+}
19
20
int main(void){
21
ios::sync_with_stdio(0);
22
cin.tie(0);
-
-}
23
24
+ cin >> n >> p >> q;
25
+ cout << solve(n);
26
27
+/*
28
+해시를 활용한 DP문제입니다.
29
30
+*/
0 commit comments