Cod sursa(job #1326948)
| Utilizator | Data | 26 ianuarie 2015 11:20:50 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | procopiu_9_oji2015 | Marime | 0.59 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream fin("fact.in");
long long p,n,i,x;
fin>>p;
fin.close();
n=0;
i=1;
ofstream fout("fact.out");
while(n<=p)
{
if(i%10==5) n++;
else if(i%10000000==0) n+=7;
else if(i%1000000==0) n+=6;
else if(i%100000==0) n+=5;
else if(i%10000==0) n+=4;
else if(i%1000==0) n+=3;
else if(i%100==0) n+=2;
else if(i%10==0) n++;
if(n==p) {x=i;break;}
i++;
}
fout<<x<<"\n";
fout.close();
return 0;
}
