import java.io.IOException;
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner s=new Scanner(System.in);
StringBuffer sb = new StringBuffer("");
BigInteger[] fact=new BigInteger[101];
fact[0]=BigInteger.ONE;
for (int i=1; i < 101; i++) {
fact[i]=fact[i-1].multiply(BigInteger.valueOf(i));
}
while(true) {
int n=s.nextInt();
int m=s.nextInt();
if(n==0 && m==0)
break;
BigInteger ans=fact[n].divide((fact[n-m]).multiply(fact[m]));
sb.append(n).append(" things taken ").append(m).append(" at a time is ").append(ans).append(" exactly.\n");
}
System.out.print(sb);
}
}
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner s=new Scanner(System.in);
StringBuffer sb = new StringBuffer("");
BigInteger[] fact=new BigInteger[101];
fact[0]=BigInteger.ONE;
for (int i=1; i < 101; i++) {
fact[i]=fact[i-1].multiply(BigInteger.valueOf(i));
}
while(true) {
int n=s.nextInt();
int m=s.nextInt();
if(n==0 && m==0)
break;
BigInteger ans=fact[n].divide((fact[n-m]).multiply(fact[m]));
sb.append(n).append(" things taken ").append(m).append(" at a time is ").append(ans).append(" exactly.\n");
}
System.out.print(sb);
}
}
No comments:
Post a Comment