Description
Input
Output
Sample Input
Sample Output
package test; import java.util.Scanner; import java.math.BigInteger; public class Fib { static BigInteger[] num = new BigInteger[205]; static String s; public static void main(String[] args){ num[1] = new BigInteger("1"); num[2] = new BigInteger("2"); for(int i = 3; i <= 201; i++){ num[i] = num[i-1].add(num[i-2]); //System.out.println(num[i]); } Scanner in = new Scanner(System.in); System.out.println("输入n"); int n = in.nextInt(); int flag = 1; while((n--) != 0){ System.out.println("输入字符串"); if(flag == 1){ in.nextLine(); flag = 0; } s = in.nextLine(); int len = s.length(); System.out.println(num[len]); } } }
原文:http://www.cnblogs.com/rain-1/p/4975999.html