Cod sursa(job #1667806)
| Utilizator | Data | 29 martie 2016 11:39:11 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
#include <math.h>
using namespace std;
ifstream fin("factorial.in");
ofstream fout("factorial.out");
int p,k,n,x;
int verif5(int n){
if(n==0)
return 1;
int p=0;
while(n!=1)
if(n%5==0){
n=n/5;
p++;}
else return 1;
return p;}
int main(){
int i;
fin>>p;
if(p==0)
fout<<1;
while(p>0){
k=verif5(x);
x+=5*k;
p=p-k;}
fout<<x;
return 0;
}
