Guest User

Untitled

a guest
Apr 26th, 2017
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. import java.math.BigInteger;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6.     public static int MAX = 41;
  7.     public static long c[][] = new long[MAX][];
  8.  
  9.     public static void main(String[] args) {
  10.         for (int i = 0; i < MAX; ++i) {
  11.             c[i] = new long[i + 1];
  12.             for (int j = 0; j <= i; ++j) {
  13.                 if ((j == 0) || (j == i)) {
  14.                     c[i][j] = 1;
  15.                 } else {
  16.                     c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
  17.                 }
  18.             }
  19.         }
  20.         Scanner sc = new Scanner(System.in);
  21.         int n = sc.nextInt();
  22.         int a = sc.nextInt();
  23.         int b = sc.nextInt();
  24.         BigInteger res = BigInteger.valueOf(c[n + a][a]);
  25.         res = res.multiply(BigInteger.valueOf(c[n + b][b]));
  26.         System.out.println(res);
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment