Cod sursa(job #871212)
Utilizator | Data | 4 februarie 2013 16:31:11 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
long p,i=1,x,s=0;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
x=p*5;
while(i<x)
{
i*=5;
s++;
}
s--;
g<<x-((s*(s-1))/2)*5;
return 0;
}