感觉没有问题却a不了

P1591 阶乘数码

sjeozq @ 2023-09-30 16:34:45

a = int(input())
b = [0] * a
c = [''] * a
e = ''
g = 1
for i in range(0, a):
    k = input().split(' ')
    b[i] = int(k[0])
    if b[i] == 0:
        b[i] = 1
    c[i] = str(k[1])
for i in range(0, a):
    count = 0
    while b[i] > 0:
        g = g * b[i]
        b[i] -= 1
    e = str(g)
    for j in range(0, len(e)):
        if c[i] == e[j]:
            count += 1
    print(count)
    g = 1
    e = ''

by szlh_XJS @ 2024-02-17 15:57:55

t=int(input())
for i in range(1,t+1):
    s=1
    v = input()
    a, b = map(int, v.split())  # 将字符串分割成两个整数

    for j in range(2,a+1):
        s*=j
    nn=str(s)
    s=0
    for i in nn:
        if int(i)== b:
            s+=1
    print(s)

|