Cod sursa(job #2620233)

Utilizator andreea.vasilescuAndreea Vasilescu andreea.vasilescu Data 28 mai 2020 16:41:25
Problema Factorial Scor 20
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<bits/stdc++.h>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
    int n,i,d=0,c=0,nr=1,cnr,ccnr;
    in>>n;
    while(d<n || c<n)
    {
        nr++;
        cnr=nr;
        ccnr=nr;
        while(cnr%2==0)
        {
            d++;
            cnr/=2;
        }
        while(ccnr%5==0) {
            c++;
            ccnr/=5;
        }
    }
    out<<nr;
    return 0;
}