/home/toolbox/public_html/solutions/103/10334/a10334.java
1 import java.util.Scanner;
2 import java.math.BigInteger;
3
4 // To submit to UVA (online judge), the class line becomes:
5 // class Main {
6 // instead of
7 // public class a10334 {
8 public class a10334
9 {
10 public static void main(String[] args)
11 {
12 int bounce;
13 BigInteger[] fib;
14
15 fib = new BigInteger[1005];
16 // init = load fib with sequence
17 fib[0] = BigInteger.valueOf(1);
18 fib[1] = BigInteger.valueOf(2);
19 for (int i = 2; 1002>i; i++)
20 {
21 // start fib sequence */
22 fib[i] = fib[i-1].add(fib[i-2]);
23 } // start fib sequence */
24
25 Scanner sc = new Scanner(System.in);
26 while (sc.hasNext())
27 {
28 bounce = sc.nextInt();
29 System.out.println(fib[bounce]);
30 }
31 }
32 }
33