题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1250
import java.util.Scanner;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
BigInteger fibonacci[] = new BigInteger[7038];
fibonacci[0] = fibonacci[1] = fibonacci[2] = fibonacci[3] = BigInteger.ONE;
for (int i = 4; i < 7038; ++i) {
fibonacci[i] = fibonacci[i - 1].add(fibonacci[i - 2])
.add(fibonacci[i - 3]).add(fibonacci[i - 4]);
// System.out.println(fibonacci[i].toString().length());
}
Scanner scn = new Scanner(System.in);
while (scn.hasNext()) {
System.out.println(fibonacci[scn.nextInt() - 1]);
}
scn.close();
}
}