damuzhi @ 2023-11-21 19:18:59
#include <bits/stdc++.h>
using namespace std;
int fast(int a){
int ans = 1;
for(int i = 1; i <= a; i++){
ans *= i;
}
return ans;
}
int main() {
int n;
cin >> n;
int a[n],b[n];
int ans[n];
for(int i =0; i < n; i++){
char temp;
cin >> a[i] >> temp;
// temp = b;
ans[i] = fast(a[i]);
int ansi = 0;
string ji = to_string(ans[i]);
for(int j = 0; j < ji.size(); j++){
if(ji[j] == temp){
ansi++;
}
}
ans[i] = ansi;
}
for(int i = 0; i < n; i++){
cout << ans[i] << endl;
}
return 0;
}
by Luzhuoyuan @ 2023-11-21 19:29:31
@damuzhi
by damuzhi @ 2023-11-21 19:31:09
@Luzhuoyuan 动了,谢谢!!!