MC_OIer @ 2023-09-05 13:46:02
#include<bits/stdc++.h>
using namespace std;
int n,len;
long long ans[3000];
void by(long long a[],int b){
for(int i=2999;!a[i];i--)len=i;
for(int i=1;i<=len;i++)a[i]*=b;
for(int i=1;i<=3000;i++){
a[i+1]+=a[i]/10;
a[i]%=10;
}
for(int i=2999;!a[i];i--)len=i;
}
int main(){
int t,n,r;
long long cnt=0;
cin>>t;
while(--t>=0){
memset(ans,0,sizeof(ans));
cnt=0;
ans[1]=1;
cin>>n>>r;
for(int i=1;i<=n;i++)by(ans,i);
for(int i=1;i<=len;i++)if(ans[i]==r)cnt++;
cout<<cnt<<endl;
}
return 0;
}
by MC_OIer @ 2023-09-05 13:47:42
WA的点
by MC_OIer @ 2023-09-05 14:01:59
没事,忘记去前导零了,当我没发