Problem B
Accepts: 2515
Submissions: 9216
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
1 3 8Hint如果序列是:(111)。可以构造出如下三个新序列:(111), (21), (12)。 Showing code:第一次有JAVA打比赛,哦呵呵,感觉好新鲜呀,此题是斐波那契数列,好题~import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { BigInteger num[] = new BigInteger[230]; num[0] = BigInteger.valueOf(0); num[1] = BigInteger.valueOf(1); num[2] = BigInteger.valueOf(2); for (int i=3; i<230; i++) { num[i] = num[i-1].add(num[i-2]); } Scanner n = new Scanner(System.in); int b; while (n.hasNextInt()) { b = n.nextInt(); System.out.println(num[b]); } } }