Lovable_Wind @ 2021-06-06 21:59:50
#include<bits/stdc++.h>
using namespace std;
const double pi=3.14;
const int inf=0x3f3f3f3f;
const int NIL=-1;
#define f(i,l,r) for(int i=l;i<=r;i++)
string s,sn;
int T,tot;
void times(int a,int p){
int tmp=0;
for (int i=s.size()-1;i>=0;i--){
int nownum=int(s[i]-48)*a+tmp%10;
tmp/=10;
tmp+=nownum/10;
nownum%=10;
sn[i]=char(nownum+48);
if (nownum==p) tot++;
}
}
int read()
{
int ans=0,flag=1;
char ch=getchar();
while( (ch>'9' || ch<'0') && ch!='-' ) ch=getchar();
if(ch=='-') flag=-1,ch=getchar();
while(ch>='0' && ch<='9') ans=ans*10+ch-'0',ch=getchar();
return ans*flag;
}
int main()
{
T=read();
while(T--){
int n=read(),p=read();
s[0]=1;
for (int i=2;i<=n;i++){
times(i,p);
}
cout<<sn<<endl;
tot=0;
s.clear();
sn.clear();
}
return 0;
}
运行之后可以输入,但是并没有返回值