Skip to content

Commit d02503f

Browse files
authored
[20250203] BOJ / 골드4 / 로또 / 권혁준
1 parent d6fee17 commit d02503f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
```java
2+
3+
import java.util.*;
4+
import java.io.*;
5+
6+
class Main {
7+
8+
// IO field
9+
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
10+
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
11+
static StringTokenizer st;
12+
13+
static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());}
14+
static int nextInt() {return Integer.parseInt(st.nextToken());}
15+
static long nextLong() {return Long.parseLong(st.nextToken());}
16+
static void bwEnd() throws Exception {bw.flush();bw.close();}
17+
18+
// Additional field
19+
20+
21+
public static void main(String[] args) throws Exception {
22+
23+
long[][] dp = new long[11][2001];
24+
for(int i=1;i<=2000;i++) dp[1][i] = i;
25+
for(int i=2;i<=10;i++) {
26+
for(int j=1;j<=2000;j++) dp[i][j] = dp[i][j-1] + dp[i-1][j/2];
27+
}
28+
29+
nextLine();
30+
int T = nextInt();
31+
32+
while(T-- > 0) {
33+
nextLine();
34+
int n = nextInt(), m = nextInt();
35+
bw.write(dp[n][m]+"\n");
36+
}
37+
38+
bwEnd();
39+
}
40+
41+
}
42+
43+
```

0 commit comments

Comments
 (0)