Cod sursa(job #742781)
Utilizator | Data | 1 mai 2012 15:18:59 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <fstream>
using namespace std;
int putere(int x)
{
int i=0;
while(!x)
{
i++;
x/=2;
}
return i;
}
int main()
{
int p;
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
if(!(p%5))
fout<<(p-putere(p/5) )*5;
else
fout<<p*5;
return 0;
}