Cod sursa(job #2609868)

Utilizator Zamfirescuste2Zamfirescu Stefan Zamfirescuste2 Data 3 mai 2020 18:16:41
Problema Factorial Scor 25
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include <fstream>

using namespace std;

int main(){

    ifstream f("fact.in");
    ofstream g("fact.out");
    int p;
    f >> p;
    int cnt = 0;
    if ( p == 0 )
        g << 1;
    else
    {
        int nr = 5;
        cnt = 1;
        while ( cnt < p){
            int aux = nr;
            while( aux % 5 == 0){
                ++cnt;
                aux = aux/5;
            }
            nr += 5;
        }
        g << nr;
    }
    return 0;
}