Cod sursa(job #1688423)
Utilizator | Data | 13 aprilie 2016 14:55:45 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
using namespace std;
unsigned long N,aux;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int x=1;
signed long P;
f>>P;
f.close();
if(P==0)
g<<x;
else
{
do{
N+=5;
aux=N;
do{
N/=5; x=N%5;
P--;
}while(!(x));
N=aux;
}while(P);
g<<N;
}
}