// UVa 10219 - Find the ways !
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNextBigInteger()) {
BigInteger n = scanner.nextBigInteger();
BigInteger k = scanner.nextBigInteger();
BigInteger num = BigInteger.ONE;
for (BigInteger i = n.subtract(k).add(BigInteger.ONE); i.compareTo(n) <= 0; i = i.add(BigInteger.ONE))
num = num.multiply(i);
BigInteger den = BigInteger.ONE;
for (BigInteger i = BigInteger.ONE; i.compareTo(k) <= 0; i = i.add(BigInteger.ONE))
den = den.multiply(i);
System.out.println(num.divide(den).toString().length());
}
}
}
Saturday, June 20, 2015
UVa 10219 - Find the ways !
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment