Skip to content

Commit d39e840

Browse files
authored
Merge pull request #6 from AlgorithmWithGod/Seol-JY
[20250203] BOJ / 골드4 / 로또 / 설진영
2 parents 65a9ffa + ac95a53 commit d39e840

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Seol-JY/202502/03 BOJ G4 로또.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
```java
2+
import java.io.*;
3+
import java.util.*;
4+
5+
public class Main {
6+
public static void main(String[] args) throws Exception {
7+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8+
9+
long[][] arr = new long[101][2_001];
10+
11+
for (long i = 1; i < 2_001; i++) {
12+
arr[1][(int)i] = i;
13+
}
14+
15+
for (long i = 2; i < 101; i++) {
16+
for (long j = 1; j < 2_001; j++) {
17+
arr[(int)i][(int)j] = arr[(int)i][(int)(j-1)] + arr[(int)(i-1)][(int)(j/2)];
18+
}
19+
}
20+
21+
long T = Long.parseLong(br.readLine());
22+
23+
for (long i = 0; i < T; i++) {
24+
StringTokenizer st = new StringTokenizer(br.readLine());
25+
long n = Long.parseLong(st.nextToken());
26+
long m = Long.parseLong(st.nextToken());
27+
System.out.println(arr[(int)n][(int)m]);
28+
}
29+
}
30+
}
31+
```

0 commit comments

Comments
 (0)