Pagini recente » Cod sursa (job #1154877) | Cod sursa (job #1559935) | Istoria paginii runda/sasasas/clasament | Cod sursa (job #404831) | Cod sursa (job #32552)
Cod sursa(job #32552)
#include<fstream.h>
#include<process.h>
int main(){
ifstream fin("fact.in");
ofstream fout("fact.out");
long long P,nr=0,S=1,k=0;
fin>>P;
if (P==0) {
fout<<1;
fin.close();}
while (nr!=P){
S=S%100;
for (short i=1;i<=10;i++){
S*=i;
k++;
if (S%10==0){
S/=10;
nr++;}
if (nr==P) {
if (P>2)
k--;
fout<<k;
fout.close();
exit(0);
}}
if (k>9)
k--;}
fout<<k;
fin.close();
fout.close();
return 0;
}