Mai intai trebuie sa te autentifici.
Cod sursa(job #350166)
| Utilizator | Data | 22 septembrie 2009 22:18:20 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream f;f.open("fact.in");
ofstream g;g.open("fact.out");
unsigned long int n,aux,nr,a,b;
f>>n;
while(n!=0)
{
f>>nr;
a=0;
b=0;
while(b<nr)
{a=a+5;
aux=a;
while(aux!=0)
{if(aux%5==0)
b++;
aux=aux/5;}
}
if(b==nr) g<<a<<endl;
else g<<"-1"<<endl;
n--;
}
g.close();
f.close();
return 0;
}