z1145674456 @ 2020-12-13 19:50:56
#include<stdio.h>
int main() {
long long a[10], b[10],k=1,tmp=1,x;
int i, j;
int n, count[10];
scanf("%d", &n);
for (i = 0;i < n;i++) {
scanf("%lld %lld", &a[i], &b[i]);
}
for (i = 0;i < n;i++) {
k = 1;
for (j = 1;j <= a[i];j++) {
k = k * j;
}
a[i] = k;
}
for (i = 0;i < n;i++) {
count[i] = 0;
x = a[i];
while (x >0) {
tmp = x % 10;
x = x / 10;
if (tmp == b[i]) {
count[i]++;
}
}
}
for (i = 0;i < n;i++) {
if (i == 0)
printf("%d", count[i]);
else
printf("\n%d", count[i]);
}
}
by z1145674456 @ 2020-12-13 19:52:33
本地运行没问题啊。。。!
by w23c3c3 @ 2020-12-13 19:52:51
大家都知道阶乘很大,所以这题要高精度
大家都知道排水系统分母很大,但是没多少人用高精度
by H3PO4 @ 2020-12-13 20:03:57
Python真香
by z1145674456 @ 2020-12-13 20:04:57
@w23c3c3 谢谢大佬,明白了:( (回复好快啊)
by z1145674456 @ 2020-12-13 20:06:40
@gzmiller 刚学c ,新晋大一 :(
by H3PO4 @ 2020-12-13 20:16:36
@z1145674456 很容易把C/C++代码改成Python
我也不是py选手, 我这题就是这么过的