#include<iostream>
#include<iomanip>
#define L long double
using namespace std;
L e;
L anik(L c, L d)
{
static double i = 0;
if(d == 0)
return 1;
if(d == e)
{
return (c/d) * anik(c-1.0, d-1.0);
}
else
{
return (c/d) * anik(c-1.0, d-1.0);
}
}
int main()
{
L n, m, a;
cout << fixed;
cout << setprecision(0);
while(cin >> n >> m)
{
if(n == 0 && m == 0)
break;
e = m;
a = anik(n, m);
cout << n << " things taken " << m << " at a time is " << a << " exactly." << endl;
}
return 0;
}
#include<iomanip>
#define L long double
using namespace std;
L e;
L anik(L c, L d)
{
static double i = 0;
if(d == 0)
return 1;
if(d == e)
{
return (c/d) * anik(c-1.0, d-1.0);
}
else
{
return (c/d) * anik(c-1.0, d-1.0);
}
}
int main()
{
L n, m, a;
cout << fixed;
cout << setprecision(0);
while(cin >> n >> m)
{
if(n == 0 && m == 0)
break;
e = m;
a = anik(n, m);
cout << n << " things taken " << m << " at a time is " << a << " exactly." << endl;
}
return 0;
}
Comments
Post a Comment