Description
Evaluate C (N, M), that is, find the number of combinations of N numbers in M number.
Input
The first line is a positive integer T (T <= 10), indicating that there are T groups of test data. Line 2 ~ Row T + 1 has two positive integers N, M (1 <= N, M <= 20 ).
Output
Input N, M in each group, and output a row. The row has a number, which is the C (N, M) value.
Sample Input
2
3 5
1 20
Sample Output
10
20
[Plain] # include <stdio. h>
_ Int64 fac (int );
Int main ()
{
Int num;
Int n;
Int m;
Scanf ("% d", & num );
While (num --)
{
Scanf ("% d", & n, & m );
Printf ("% d", fac (m)/fac (n)/fac (m-n ));
If (num> 0)
{
Printf ("\ n ");
}
}
Return 0;
}
_ Int64 fac (int)
{
Int I;
_ Int64 sum;
Sum = 1;
If (a = 0)
{
Sum = 1;
}
Else
{
For (I = 1; I <= a; I ++)
{
Sum * = I;
}
}
Return sum;
}
# Include <stdio. h>
_ Int64 fac (int );
Int main ()
{
Int num;
Int n;
Int m;
Scanf ("% d", & num );
While (num --)
{
Scanf ("% d", & n, & m );
Printf ("% d", fac (m)/fac (n)/fac (m-n ));
If (num> 0)
{
Printf ("\ n ");
}
}
Return 0;
}
_ Int64 fac (int)
{
Int I;
_ Int64 sum;
Sum = 1;
If (a = 0)
{
Sum = 1;
}
Else
{
For (I = 1; I <= a; I ++)
{
Sum * = I;
}
}
Return sum;
}