Cod sursa(job #1658405)

Utilizator LaurIleIle Laurentiu Daniel LaurIle Data 21 martie 2016 14:45:55
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int a,b;
 long long n=1;
int main()
{    int i=0,P,x;
     f>>P;
    b=P;
    if (P==0) g<<1;
    else
    while (i!=1)
    {
        i+=5;
        x=i;
        while(x!=0)
        {
        if (x%5==0)
        {
        a++; if(a==b) {n=x; x=0; i=1;} }
        x=x/5;

        }

    }

    g<<n;

    return 0;
}