-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGOODB.java
42 lines (36 loc) · 1.06 KB
/
GOODB.java
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
34
35
36
37
38
39
40
41
import java.math.BigInteger;
import java.util.Scanner;
class Main
{
public static BigInteger mod = BigInteger.valueOf(1000000007);
static public void main(String [] args)
{
int n, w, r, t;
Scanner input = new Scanner(System.in);
n = input.nextInt();
w = input.nextInt();
r = input.nextInt();
t = input.nextInt();
BigInteger n1 = BigInteger.valueOf(n);
BigInteger w1 = BigInteger.valueOf(w);
BigInteger r1 = BigInteger.valueOf(r);
BigInteger t1 = BigInteger.valueOf(t);
BigInteger num = fact(n1);
BigInteger den = fact(w1).multiply(fact(r1));
den = den.multiply(fact(t1));
BigInteger ans = num.divide(den);
ans = ans.mod(mod);
System.out.println(ans);
}
public static BigInteger fact(BigInteger n)
{
int num = n.intValue();
int i = 1;
BigInteger sum = BigInteger.valueOf(1);
for(i = 1;i<=num;++i)
{
sum = sum.multiply(BigInteger.valueOf(i));
}
return sum;
}
}