[Offer收割]编程练习赛36 register

Ended

Participants:242

Verdict:Runtime Error
Score:70 / 100
Submitted:2017-11-19 14:00:09

Lang:Java

Edit
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
import java.util.*;
import java.io .*;
import java.math.*;
public class Main
{
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        BigInteger []fac=new BigInteger[10010];
        fac[0]=BigInteger.valueOf(1);
        for(int i=1;i<=10000;i++)fac[i]=fac[i-1].multiply(BigInteger.valueOf(i));
        int t=cin.nextInt();
        while(t-->0)
        {
            int n=cin.nextInt();
            BigInteger y;
            y=BigInteger.valueOf(1);
            int sum=0;
            for(int i=1;i<=n;i++)
            {
                int j=cin.nextInt();
                sum+=j;
                y=y.multiply(fac[j]);
            }
            System.out.println(fac[sum].divide(y).mod(BigInteger.valueOf(10)));
        }
    }
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX