-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUva10007.java
More file actions
33 lines (29 loc) · 1017 Bytes
/
Copy pathUva10007.java
File metadata and controls
33 lines (29 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.*;
import java.io.*;
import java.math.BigInteger ;
public class Uva10007
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pr = new PrintWriter(System.out);
StringBuilder sb = new StringBuilder();
int N = 301 ;
BigInteger [] a = new BigInteger[N];
BigInteger [] f = new BigInteger[N];
a[0] = f[0] = BigInteger.valueOf(1L);
for(int i = 1 ; i < N ; i++){
int num = 2*i * (2*i-1);
int den = (i+1) * i ;
a[i] = a[i-1].multiply(BigInteger.valueOf(num)).divide(BigInteger.valueOf(den));
f[i] = f[i-1].multiply(BigInteger.valueOf(i));
}
int n = 0 ;
while( (n = Integer.parseInt(br.readLine())) != 0 ){
sb.append(a[n].multiply(f[n]).toString()).append('\n');
}
pr.print(sb.toString());
pr.close();
br.close();
}
}