#include<string>
#include<sstream>
using namespace std;
void replaceD(string &str)
{
int i = 0;
while(i < str.length())
{
if (str[i] == ',')
str[i] = ' ';
i++;
}
}
long double f(int a)
{
if (a == 1 || a == 0)
return 1;
else
return (a * f(a - 1));
}
long double F(int m,int n)
{
if (n == 1)
return 1;
else if (n == 0 || n > m)
return 0;
return f(m) / f(m - n);
}
int main()
{
int t,m,n;
string str;
cin >> t;
getline(cin,str);
for (int i = 0;i < t; i++)
{
getline(cin,str);
replaceD(str);
stringstream ss(str);
ss >> m >> n;
cout << F(m,n) << endl;
}
return 0;
}
沒有留言:
張貼留言