nyoj-655-光棍的yy(大斐波那契数列)
1 /* 2 思路: 3 考察大斐波那契数列 4 */ 5 import java.util.*; 6 import java.math.*; 7 public class Main{ 8 9 public static void main(String[] args) { 10 final int MAXN = 205; 11 BigInteger nums[] = new BigInteger[MAXN]; 12 nums[1] = BigInteger.ONE; 13 nums[2] = BigInteger.valueOf(2); 14 nums[3] = BigInteger.valueOf(3); 15 for (int i=4; i<MAXN; i++) { 16 nums[i] = nums[i-2].add(nums[i-1]); 17 } 18 Scanner cin = new Scanner(System.in); 19 int t = cin.nextInt(); 20 21 while (t-- > 0) { 22 String str = cin.next(); 23 System.out.println(nums[str.length()]); 24 } 25 } 26 }