Cod sursa(job #1779326)
Utilizator | Data | 15 octombrie 2016 09:16:20 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
using namespace std;
long long n,nr=0,i=0,x;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>n;
while (nr!=n)
{
i=i+5;
nr++;
x=i;
while (x%25==0)
{
nr++;
x=x/25;
}
if (nr>n) {
g<<-1;
return 0;
}
}
g<<i;
return 0;
}