Cod sursa(job #1189974)

Utilizator teodor440Teodor Tonghioiu teodor440 Data 24 mai 2014 09:32:32
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <iostream>
#include <fstream>

using namespace std;

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

bool verif(long long x){
    while(x>1){\
        if(x%5) return 0;
        x/=5;
    }
    return 1;
}

int main()
{
    long long x;
    int n;
    f>>n;
    x=0;
    while(n>0){
        x+=5;
        n--;
        if(x>5&&verif(x)){
            n--;
        }
    }
    if(n) g<<-1;
    else g<<x;

    return 0;
}