Problem 1001 1002

wangqiurong | 2016-05-15 20:28:32Author
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String[] strs = str.trim().split(\"\\\\s{1,}\"); int[] arr = new int[strs.length]; BigInteger[] b = new BigInteger[201]; b[0] = BigInteger.valueOf(0); b[1] = BigInteger.valueOf(1); b[2] = BigInteger.valueOf(2); for(int i = 3; i < b.length;i++) { b[i] = b[i-1].add(b[i-2]); } for (int i = 0; i < strs.length; i++) { arr[i]= Integer.parseInt(strs[i]); if (arr[i]>=1 && arr[i]<=200) { System.out.println(b[arr[i]]); }else { System.out.println(); } } } } ÇóÎÊÔõô´íÁË