Cod sursa(job #1115551)
Utilizator | Data | 21 februarie 2014 21:41:32 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include<fstream>
using namespace std;
long long p,n,x,m=5,k;
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
if(!p){fout<<1;return 0;}
do
{
n+=5;
if(n==m)k++,m=m*5;
x+=k;
}while(x!=p);
fout<<n;
return 0;
}