hkc101 @ 2024-04-15 21:21:23
全wa,样例过了!!!
代码:
#include <bits/stdc++.h>
using namespace std;
long long int n[11], a[11];
long long int jc(int x) {
long long int h = 1;
for (int i = 1; i <= x; i++) {
h = h * i;
}
return h;
}
long long int jx(int a, int h) {
long long int s = 0;
while (h) {
if (h % 10 == a) {
s++;
}
h = h / 10;
}
return s;
}
int main() {
long long int t;
cin >> t;
for (long long int i = 1; i <= t; i++) {
cin >> n[i] >> a[i];
}
for (long long int i = 1; i <= t; i++) {
cout << jx(a[i], jc(n[i])) << endl;
}
}
by Wyy20120223 @ 2024-04-15 21:32:21
a数组在第二次算的时候没归零
by Wyy20120223 @ 2024-04-15 21:34:46
好像又不是......当我没说吧
by sll00 @ 2024-04-15 21:43:13
@hkc101 其实long long 在50!就会爆,这里要求是用高精度算法
by hkc101 @ 2024-04-16 19:55:52
@sll00 为啥?
by hkc101 @ 2024-04-16 19:58:17
题目只说t<=10
by sll00 @ 2024-04-16 20:08:05
@hkc101 t是组数,题目要求的是n!..
这个没什么好说的,long long最多到多大的数据范围可以自己查一下,学习一下,提升一下认知
by hkc101 @ 2024-04-16 20:36:00
呃
by 100WINNER @ 2024-05-24 14:34:24
??????????????????????????