Cod sursa(job #2853788)

Utilizator alinat15Tircob Alina alinat15 Data 20 februarie 2022 17:07:11
Problema Factorial Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fact.in");
ofstream gout("fact.out");
int main()
{
    long long int n,m,a,aux;
    int c;
    fin>>n;
    m=5*n;
    a=25;
    c=1;
    aux=m;
    while(a<=aux)
    {
        m=m-c*5;
        a=a*5;
        c++;
    }
    if(n==0)
    {
        m=1;
    }
    gout<<m;
}