Cod sursa(job #2615382)
Utilizator | Data | 14 mai 2020 15:38:55 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream cin("fact.in");
ofstream cout("fact.out");
int p,x=1,s=0,cnt=0;
cin>>p;
s=p*5;
p--;
while(1)
{
cnt++;
x*=5;
if(x>p) break;
}
cnt--;
s=s-5*cnt;
cout<<s;
return 0;
}