Cod sursa(job #3282053)
Utilizator | Data | 4 martie 2025 12:59:41 | |
---|---|---|---|
Problema | Factorial | Scor | 80 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
int n,p=0;
in>>n;
int ind=0;
if(!n){
out<<1;
}
else {
while(n>p){
int q=ind;
while(q){
if(q%5==0){
q/=5;
p++;
}
else{
q=0;
}
}
ind+=5;
}
out<<ind-5;
}
return 0;
}