Cod sursa(job #2282621)

Utilizator Justice88Tirisi Claudiu Justice88 Data 14 noiembrie 2018 10:22:45
Problema Factorial Scor 25
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<fstream>
#include<iostream>
using namespace std;
ifstream f("fact.in");
ofstream o("fact.out");
int n, k=1, a=5;
void citire(){
f>>n;
}
int h5(int x){
int g=0;
while(x!=0 && x%5==0){
g++;
x=x/5;
}
return g;
}
void prel(){
while(k!=n){
k+=h5(a);
a+=5;
}
}
void afisare(){
o<<a;
}
int main(){
citire();
if(n==0){
o<<int(1);
} else {
prel();
afisare();
}
return 0;
}