// UVa 10334 - Ray Through Glasses import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); BigInteger[] fib = new BigInteger[1001]; int m = 1; fib[0] = BigInteger.ONE; fib[1] = BigInteger.valueOf(2); while (scan.hasNextInt()) { int n = scan.nextInt(); while (m < n) { m++; fib[m] = fib[m - 1].add(fib[m - 2]); } System.out.println(fib[n]); } } }
Showing posts with label UVa 10334 - Ray Through Glasses. Show all posts
Showing posts with label UVa 10334 - Ray Through Glasses. Show all posts
Sunday, July 12, 2015
UVa 10334 - Ray Through Glasses
Subscribe to:
Posts (Atom)