Cod sursa(job #2406398)

Utilizator VladP02Popescu Vlad VladP02 Data 15 aprilie 2019 18:31:41
Problema Factorial Scor 15
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int verificare(int x) {
    int suma=0,putere=5,copie=5;
    if(putere<=x) {
        while(putere<=x) putere=putere*5;
        putere=putere/5;
    }
    while(copie<=putere) {
        suma=suma+x/copie;
        copie=copie*5;
    }
    return suma;
}
int formare(int n) {
    int nr=1,ok=0;
    if(n==0) return nr; else nr=5;
    while(ok==0) {
        if(verificare(nr)==n) return nr;
        else nr+=5;
    }


}
int n;
int main()
{
    f >> n;
    g << formare(n);
    return 0;
}