반응형
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static long[][] pascal = new long[51][51];
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
pascal[1][1] = 1;
fillSide(1, 2);
fillSide(2, 1);
Start(2, 2);
int x = sc.nextInt();
int y = sc.nextInt();
System.out.println(pascal[x][y] % 100000000);
}
public static void Start(int x, int y) {
pascal[x][y] = pascal[x - 1][y] + pascal[x][y - 1] % 100000000;
y++;
if(y == 50) {
x++;
y = 2;
}
if(x >= 2 && x < 50) {
Start(x, y);
}
}
public static void fillSide(int x, int y) {
pascal[x][y] = 1;
if (y >= 2 && y < 50) {
fillSide(x, ++y);
}
if (x >= 2 && x < 50) {
fillSide(++x, y);
}
}
}
반응형
'프로그래밍 > 코드업 일기' 카테고리의 다른 글
코드업(Codeup) 4051 : 시간외 근무 수당 (0) | 2023.08.10 |
---|---|
코드업(Codeup) 4041 : 숫자 다루기 (0) | 2023.08.10 |
코드업(Codeup) 3004 : 데이터 재정렬 (0) | 2023.08.10 |
코드업(Codeup) 2634 : 거스름돈 II (0) | 2023.08.10 |
코드업(Codeup) 2631 : 보물 찾기 (0) | 2023.08.10 |