Cod sursa(job #1367609)
Utilizator | Data | 1 martie 2015 23:32:25 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include<fstream>
using namespace std;
int main(){
unsigned long P;
unsigned long long N=1, k=1;
ifstream in;
in.open("fact.in");
in>>P;
in.close();
if(P>0)
{
for(long i=0;i<P;i++)
{
k*=5;
}
}
else
{
k=1;
}
unsigned short i=0;
while(N%k!=0)
{
i+=5;
N*=i;
}
ofstream out;
out.open("fact.out");
out<<i;
out.close();
}