为啥全WA了啊,感觉没问题啊
查看原帖
为啥全WA了啊,感觉没问题啊
845879
yawningking楼主2023/3/3 19:03
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
using namespace std;
int main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        int n;
        cin >> n;
        int  l = 1;
        for (int j = n; j > 1; j--) {
            l = l * j;
        }
        int a;
        cin >> a;
        string s1 = l + "";
        int ans = 0;
        for (int k = 0; k < s1.length(); k++) {
            if (s1[k] == a) {
                ans++;
            }
            cout << ans << endl;
        }
    }
    return 0;
}

P1591 阶乘数码

2023/3/3 19:03
加载中...