哪里错了

P1591 阶乘数码

ld_k_s @ 2019-08-01 15:37:26

#include <bits/stdc++.h>
using namespace std;

int main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        int n, a, c = 0;
        cin >> n >> a;
        long long s = 1;
        for (int j = 1; j <= n; j++) {
            s *= j;
        }
        while (s != 0) {
            if (s % 10 == a) {
                c++;
            }
            s /= 10;
        }
        cout << c << endl;
    }
    return 0;
}

by Pine_applee @ 2020-01-07 15:59:24

高精


|