Cod sursa(job #2068026)

Utilizator Andrei_RAndrei Roceanu Andrei_R Data 17 noiembrie 2017 09:15:29
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <iostream>
#include <fstream>

using namespace std;

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

// shiftat 1<<l ( 2^l )

int main()
{
    int n, p, i, ci, doi, cinci;
    f >> p;
    n = i = 1;
    doi = cinci = 0;
    while ( p > 0 ) {
        ci = i;
        while ( ci % 5 == 0 ) {
            cinci++;
            ci /= 5;
            p--;
        }
        i++;
    }
    g << i;
    f.close();
    g.close();
    return 0;
}