diff --git "a/0224LJH/202512/10 BOJ \353\254\264\355\225\234 \354\210\230\354\227\2642.md" "b/0224LJH/202512/10 BOJ \353\254\264\355\225\234 \354\210\230\354\227\2642.md" new file mode 100644 index 00000000..52ea99da --- /dev/null +++ "b/0224LJH/202512/10 BOJ \353\254\264\355\225\234 \354\210\230\354\227\2642.md" @@ -0,0 +1,56 @@ +```java + +import java.util.StringTokenizer; +import java.util.*; +import java.io.*; + +public class Main { + + static long N,P,Q,X,Y,ans; + static HashMap map = new HashMap<>(); + + + public static void main(String[] args) throws IOException { + init(); + process(); + print(); + + } + + private static void init() throws IOException{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + N = Long.parseLong(st.nextToken()); + P = Long.parseLong(st.nextToken()); + Q = Long.parseLong(st.nextToken()); + X = Long.parseLong(st.nextToken()); + Y = Long.parseLong(st.nextToken()); + + + + } + + private static void process() throws IOException { + ans = recursive(N); + + + } + + public static long recursive(long num) { + if (num <= 0)return 1; + if (map.containsKey(num)) return map.get(num); + + long newNum1 = num/P - X; + long newNum2 = num/Q - Y; + + long nResult = recursive(newNum1) + recursive(newNum2); + map.put(num,nResult); + return nResult; + } + + private static void print() { + System.out.println(ans); + } + +} +```