백준 13699 점화식 [Java]

빨대씹는버릇있음·2023년 3월 27일

백준 실버

목록 보기
15/25
import java.io.*;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
		int n = Integer.parseInt(br.readLine());
		
		
		long [] t = new long[36];
		
		t[0] = 1;
		for(int i=1; i<=n; i++) {
			t[i] = 0;

			for(int j=0; j<i; j++) {
				t[i] += (t[j]*t[i-1-j]);
			}
		}
		
		
		System.out.println(t[n]);

	}	
}

2023-03-27

0개의 댓글