Cod sursa(job #1716444)
Utilizator | Data | 12 iunie 2016 19:46:48 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p,n;
int main()
{
f>>p; int x; bool ok=true;
x=5*p; int po=2,k=5;
while(ok)
{
if(x/pow(k,po)>1) p=p-floor(x/pow(k,po))+1;
else ok=false;
po++;
}
g<<p*5;
return 0;
}