Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num = scanner.nextInt();
- System.out.println(f(num));
- }
- public static int f(int n) {
- if (n == 1)
- return 1;
- else {
- int sum = 0;
- for(int k = 1;k < n;k++)
- sum = sum + f(k) * f(n - k);
- return sum;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement