hdu 1261 字串数
指数型母函数应用!!!
import java.math.*; import java.util.*;
public class Main {
public static int []a;
public static void main(String arg[]){
BigInteger [] p =new BigInteger[313];
p[1]=BigInteger.ONE;
int i;
for(i=2;i<=312;i++){
p[i] = p[i-1].multiply(BigInteger.valueOf(i));
}
Scanner cin = new Scanner(System.in);
a =new int[27];
int t,sum;
while (true){
t = cin.nextInt();
if(t==0) break;
sum=0;
for(i=0;i<t;i++){
a[i]=cin.nextInt();
sum+=a[i];
}
BigInteger ans = p[sum];
for(i=0;i<t;i++){
ans=ans.divide(p[a[i]]);
}
System.out.println(ans.toString());
}
}
}