Cod sursa(job #1396620)
Utilizator | Data | 22 martie 2015 19:25:30 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <iostream>
#include <fstream>
using namespace std;
long long p,nr=0,n;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
n=0;
if (p==0) {g<<1;return 0;}
if (p<0) {g<<-1;return 0;}
else
while (nr<=p)
{
if (n%25==0) nr=nr+2;
else nr++;
n=n+5;
}
g<<n;
return 0;
}