Cod sursa(job #2385288)

Utilizator TheRealGamerFat Vlad TheRealGamer Data 21 martie 2019 19:10:13
Problema Factorial Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;

ifstream in("fact.in");
ofstream out("fact.out");

int main(){
    int n, nr = 0, z = 5, aux;
    in>>n;
    while(nr < n){
        aux = z;
        while(aux % 5 == 0){
            nr++;
            aux /=5;
        }
        z += 5;
    }
    if(nr > n)
        out<<z-8;
    else if(z- 5 == 0)
        out<<1;
    else
        out<<z - 5;
    return 0;
}