Cod sursa(job #1289526)

Utilizator wGEORGEWGeorge Cioti wGEORGEW Data 9 decembrie 2014 22:48:30
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <iostream>
#include <fstream>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    int p ,x=0 ,a;
    f>>p;
    if(p==0)
        g<<"1";
    else{
    while(p>0)
    {
        x+=5;
        a=x;
        while(a%5==0)
        {
            p--;
            a/=5;
        }
    }
    g<<x;}
    return 0;
}