http://120.78.162.102/problem.php?cid=1432&pid=0

http://120.78.162.102/problem.php?id=6240

题解:组数用杨辉三角

因子:https://blog.csdn.net/haut_ykc/article/details/78175349

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
ll t,n,m,k,q;
ll a[505]={1,1},b[500];
ll dp[450][450],cnt;
ll ai[N][N];
void init(){
	for(int i=2;i<=432;i++)
	{
		if(a[i])
			continue;
		b[++cnt]=i;
		for(int j=i*i;j<=432;j+=i)
			a[j]=1;
	}
	for(int i=2;i<=432;i++)
	{
		for(int j=1;b[j]<=i && j<=cnt;j++)
		{
			ll tmp=i,res=0;
			while(tmp)
				tmp/=b[j],res+=tmp;
			dp[i][b[j]]=res;
		}
	}
}
int main()
{
#ifdef DEBUG
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
    ai[0][0]=1;
    for(int i=1;i<=50;i++){
        ai[i][0]=ai[i][i]=1;
        for(int j=1;j<i;j++){
            ai[i][j]=ai[i-1][j-1]+ai[i-1][j];
        }
    }
    init();
    while(scanf("%lld%lld",&n,&m)!=EOF){
        ll ans=1;
		for(int i=1;b[i]<=n && i<=cnt;i++){
			ll tmp=dp[n][b[i]]-dp[m][b[i]]-dp[n-m][b[i]];
			ans=ans*(tmp+1);
		}
        cout << ai[n][m] <<" "<< ans << endl;
    }


    //cout << "Hello world!" << endl;
    return 0;
}