Cod sursa(job #2211133)
Utilizator | Data | 9 iunie 2018 14:02:23 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int p=0,s=1;
int main()
{
in >> p;
if(p==0) out << 1;
else{
int n = 3;
while(p){
s*=n;
while(s%10==0) s/=10,p--;
s%=10;
n++;
}
out << n-1;
}
return 0;
}