YIDINGZ @ 2022-03-18 20:28:52
#include<bits/stdc++.h>
using namespace std;
string s,t;
int a[10100],b[10000],c[10000];
int len=1;
int main(){
int c,n,m,sum = 0;
cin >> c;
for(int q = 1;q <= c;q++)
{
cin >> n >> m;
a[1]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=len;j++) {
a[j]=a[j]*i;
}
int p=1;
while(a[p]>=10 || p<len){
a[p+1]+=a[p]/10;
a[p]%=10;
p++;
}
len=p;
}
for(int i=len;i>=1;i--)
{
if(a[i] == m)
{
sum++;
}
}
cout << sum<<endl;
sum = 0;
}
return 0;
}
by Escapism @ 2022-03-18 20:38:05
@YIDINGZ 看不懂 讲一下思路
by March_Chen @ 2022-06-13 21:49:19
@YIDINGZ 数组清零了吗