Cod sursa(job #780106)
Utilizator | Data | 19 august 2012 21:58:18 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <fstream>
using namespace std;
int main()
{
int n, i, cautat, contor=0;
ifstream f("fact.in");
ofstream g("fact.out");
f>>n;
if(n!=0)
{
for(i=5; ; i+=5)
{
if(i%25==0)
contor+=2;
else
contor++;
if(contor==n)
{
cautat=i;
break;
}
else if(contor>n)
{
cautat=-1;
break;
}
}
g<<cautat;
}
else g<<1;
}