// UVa 10943 - How do you add?
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int k = scan.nextInt();
while (n != 0 && k != 0){
BigInteger num = BigInteger.ONE;
BigInteger den = BigInteger.ONE;
for (int i=1; i<k; i++){
num = num.multiply(BigInteger.valueOf(n+i));
den = den.multiply(BigInteger.valueOf(i));
}
System.out.println(num.divide(den).mod(BigInteger.valueOf(1000000)));
n = scan.nextInt();
k = scan.nextInt();
}
}
}
Tuesday, October 27, 2015
UVa 10943 - How do you add?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment