标签:
3
4
4
9
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main{
public static void main(String args[]){
BigInteger a[] = new BigInteger[100005];
final BigInteger MOD = BigInteger.valueOf(10).pow(100);
a[1] = BigInteger.ONE;
a[2] = BigInteger.valueOf(2);
for(int i=3; i<10005; i++){
a[i] = ( a[i-1].multiply(BigInteger.valueOf(2*i+1)).add(a[i-2].multiply(BigInteger.valueOf(3*i-3))) ).divide(BigInteger.valueOf(i+2));
}
Scanner in = new Scanner(System.in);
int n;
while(in.hasNextInt()){
n = in.nextInt();
System.out.println(a[n].mod(MOD));
}
}
}
标签:
原文地址:http://blog.csdn.net/qingshui23/article/details/52071836