Cod sursa(job #1268651)

Utilizator roberta9533Pavel Roberta roberta9533 Data 21 noiembrie 2014 11:12:15
Problema Factorial Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");


int main()
{
    int p,i,x;
    f>>p;
    i=0;
    while(p>0)
    {
        i=i+5;
        x=i;
        while(x%5==0)
        {
            x=x/5;
            p--;
        }
    }
    if(i==0) g<<1;
        else if(p==0) g<<i;
                else g<<-1;
    return 0;
}