123456zzr @ 2023-05-06 21:13:06
using namespace std;
struct likP{
int ansl,a,n,ip;
}ans[11];
int a[10000001]={1,1},t;
int cmp(likP a,likP b)
{
return a.n<b.n;
}
void gjj(int n)
{
int x=0;
for(int i=1;i<=a[0];i++)
{
a[i]*=n;
a[i]+=x;
x=a[i]/10;
a[i]%=10;
}
while(x)
{
a[0]++;
a[a[0]]+=x;
x=a[a[0]]/10;
a[a[0]]%=10;
}
}
int ssz(int as)
{
int sum=0;
for(int i=1;i<=a[0];i++)
{
if(a[i]==as)
{
sum++;
}
}return sum;
}
int cmpl(likP a,likP b)
{
return a.ip<b.ip;
}
int main()
{
cin>>t;
for(int i=1;i<=t;i++)
{
cin>>ans[i].n>>ans[i].a;
ans[i].ip=i;
}
sort(ans+1,ans+t+1,cmp);
int j=2;
for(int i=1;i<=t;i++)
{
while(j<=ans[i].n )
{
gjj(j);
j++;
}
ans[i].ansl=ssz(ans[i].a);
}sort(ans+1,ans+t+1,cmpl);
for(int i=1;i<=t;i++)
{
cout<<ans[i].ansl<<endl;
}return 0;
}```
[结果](https://www.luogu.com.cn/record/109715816)
by 123456zzr @ 2023-05-06 21:43:39
本贴已尽,保留纯粹为提醒自己,各位大佬当个笑话笑笑即可