HDU

http://acm.hdu.edu.cn/showproblem.php?pid=1715

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		BigInteger f[] = new BigInteger[1005];
		f[1] = BigInteger.ONE;
		f[2] = BigInteger.ONE;
		for (int i = 3; i <= 1000; i++) {
			f[i] = f[i - 1].add(f[i - 2]);
		}

		while (sc.hasNext()) {
			int t = sc.nextInt();
			while (t-- > 0) {
				int n = sc.nextInt();
				System.out.println(f[n]);
			}
		}

		sc.close();
	}
}
原文地址:https://www.cnblogs.com/Yinku/p/10743594.html