全wa,help
查看原帖
全wa,help
1108007
qqq123456qqq楼主2024/4/6 17:34
#include<stdio.h>
int a,b,len=1,c1,c[100000];
int main(){
	int t;
	scanf("%d",&t);
	for(int i=1;i<=t;i++){
		scanf("%d%d",&a,&b);
		for(int j=2;j<=len;j++) c[j]=0;
		c[1]=1;
		len=1;
		c1=0;
		for(int j=1;j<=a;j++){
			for(int k=1;k<=len;k++){
				c[k]=j*c[k];
			}
			for(int k=1;k<=len;k++){
				c[k+1]+=c[k]/10;
				c[k]=c[k]%10;
			}
			if(c[len+1]!=0) len++;
		}
		for(int j=1;j<=len;j++){
				if(c[j]==b) c1++;
		}
		printf("%d\n",c1);
	}
	return 0;
}
2024/4/6 17:34
加载中...