-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboj19947.java
More file actions
41 lines (32 loc) · 1.03 KB
/
boj19947.java
File metadata and controls
41 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class boj19947 {
static int H, Y;
static long[] dp;
public static void main(String[] args) throws IOException {
input();
pro();
}
static void input() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
H = Integer.parseInt(st.nextToken());
Y = Integer.parseInt(st.nextToken());
dp = new long[Y + 1];
}
static void pro() {
dp[0] = H;
for (int i = 1; i <= Y; i++) {
dp[i] = (long) Math.floor(dp[i - 1] * 1.05);
if (i >= 3) {
dp[i] = Math.max((long) Math.floor(dp[i - 3] * 1.2), dp[i]);
}
if (i >= 5) {
dp[i] = Math.max((long) Math.floor(dp[i - 5] * 1.35), dp[i]);
}
}
System.out.println(dp[Y]);
}
}