简单题
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
#include
<
iostream
>
#include < cstdio >
#include < cstdlib >
#include < cstring >
using namespace std;
long long com( long long n, long long r)
{
if (n - r < r)
r = n - r;
long long i, j, s = 1 ;
for (i = 0 , j = 1 ; i < r; ++ i)
{
s *= (n - i);
for (; j <= r && s % j == 0 ; ++ j)
s /= j;
}
return s;
}
int main()
{
// freopen("t.txt", "r", stdin);
long long m, n;
while (scanf( " %lld%lld " , & m, & n), m | n)
printf( " %lld things taken %lld at a time is %lld exactly.\n " , m, n, com(m, n));
return 0 ;
}
#include < cstdio >
#include < cstdlib >
#include < cstring >
using namespace std;
long long com( long long n, long long r)
{
if (n - r < r)
r = n - r;
long long i, j, s = 1 ;
for (i = 0 , j = 1 ; i < r; ++ i)
{
s *= (n - i);
for (; j <= r && s % j == 0 ; ++ j)
s /= j;
}
return s;
}
int main()
{
// freopen("t.txt", "r", stdin);
long long m, n;
while (scanf( " %lld%lld " , & m, & n), m | n)
printf( " %lld things taken %lld at a time is %lld exactly.\n " , m, n, com(m, n));
return 0 ;
}