题目描述
求 n!n!n! 中某个数码出现的次数。
输入格式
第一行为 t(t≤10)t(t \leq 10)t(t≤10),表示数据组数。接下来 ttt 行,每行一个正整数 n(n≤1000)n(n \leq 1000)n(n≤1000) 和数码 aaa。
输出格式
对于每组数据,输出一个整数,表示 n!n!n! 中 aaa 出现的次数。
输入输出样例
输入 #1
2
5 2
7 0
输出 #1
1
2
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
using namespace std;
const int maxn = 1e5 + 10;
int n, k;
struct bign{
int len;
int d[maxn];
bign() {
len