Thứ Ba, 3 tháng 5, 2022

CHUSO0 C++

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

int dem(int x)
{
    int d = 0;
    while (x % 5 == 0)
    {
        x=x/5;
        d++;
    }
    return d;
}
int main()
{
    freopen("chuso0.inp","r",stdin);
    freopen("chuso0.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int res = 0;
    for (int i = 1; i <= n; i++)
    {
        res += dem(i);
    }
    cout<<res;
}

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.