Cod sursa(job #831812)
| Utilizator | Data | 9 decembrie 2012 11:44:35 | |
|---|---|---|---|
| Problema | Factorial | Scor | 15 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<fstream>
using namespace std;
ifstream in;
ofstream out;
long long p,t=0,rasp=0;
int factxiny(int x,int y){
int p=0;
while(y%x==0)
{
p++;
y=y/x;
}
return p;
}
int main(){
int player_unu=0;
in.open("fact.in");
out.open("fact.out");
in>>p;
if(p==0)
out<<1;
else
{
for(int i=5;i<=100000;i=i+5)
{
t=t+factxiny(5,i);
if(t>=p)
{
rasp=i;
break;
}
}
out<<rasp;}
in.close();
out.close();
return player_unu;
}