Cod sursa(job #1563244)
Utilizator | Data | 5 ianuarie 2016 19:46:16 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int p,x;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
int n=0,s=0;
if(p==0) g<<"1";
else
{
while(s<p)
{
n+=5;
x=n;
while(x%5==0)
{
s++;
x/=5;
}
}
g<<n;
}
}