Cod sursa(job #1209181)

Utilizator cristibogdanPatrascu Cristian cristibogdan Data 17 iulie 2014 12:04:14
Problema Factorial Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <fstream>

using namespace std;
ifstream f ("fact.in");
ofstream g("fact.out");
int t,p;
long long z,a;

int main()
{
    f>>p;
    if(p==0)
        g<<1;
    else{
    while(t<p){
        z=z+5;
        a=z;
        while(a%5==0){
            t++;
            a=a/5;
        }}

        if(t==p)
            g<<z;
        else
            g<<-1;}


    return 0;
}