0分求助!!!第一个回复有惊喜(私信)

P1591 阶乘数码

dongrq_cs @ 2023-04-01 20:13:28

#include <bits/stdc++.h>
using namespace std;
int n;
int a[1001],b[1001];
int f(int a){
    int sum = 1;
    for(int i = 1;i <= a;i++){
        sum *= i;
    }
    return sum;
}
int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a[i] >> b[i];
    }
    for(int i = 0;i < n;i++){
        int cnt = 0;
        int m = f(a[i]);
        while(m){
            if(m % 10 == b[i]){
                cnt++;
            }
            m /= 10;
        }
        cout << cnt << endl;
    }
    return 0;
}

by JRJMC_qwqqwq @ 2023-04-01 20:14:25

az


by JRJMC_qwqqwq @ 2023-04-01 20:15:08

惊喜是什么???@dongrq_cs


by 654179_qwq @ 2023-04-01 20:20:43


by Jorisy @ 2023-04-01 20:21:01

复有惊喜(私信)


by 654179_qwq @ 2023-04-01 20:21:31

@dongrq_cs 第一个回 "复" 字的有惊喜是吗 ? 是什么 ?


by dongrq_cs @ 2023-04-01 20:25:01

不是,你们要帮我纠错,谁第一个让我AC谁就拿惊喜


by hank0402 @ 2023-04-01 20:27:50

兄弟,要高精,你真当 int 存的下 1000!


by hank0402 @ 2023-04-01 20:29:13

@dongrq_cs


by wangjiawen @ 2023-04-01 20:29:36

注:

1000!=4.02387260077093773543702433923e+2567

所以要用高精乘,我也不大会写


by dongrq_cs @ 2023-04-01 20:30:25

也就是说用long long吗?


| 下一页