// UVa 10198 - Counting import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { BigInteger[] T = new BigInteger[1001]; T[0] = new BigInteger("1"); T[1] = new BigInteger("2"); T[2] = new BigInteger("5"); for (int i=3; i<=1000; i++){ T[i] = new BigInteger("0"); T[i] = T[i].add(T[i-1]).add(T[i-1]).add(T[i-2]).add(T[i-3]); } Scanner scanner = new Scanner(System.in); while (scanner.hasNextInt()){ int n = scanner.nextInt(); System.out.printf("%s\n",T[n].toString()); } } }
Showing posts with label UVa 10198 - Counting. Show all posts
Showing posts with label UVa 10198 - Counting. Show all posts
Friday, June 19, 2015
UVa 10198 - Counting
Subscribe to:
Posts (Atom)