Cod sursa(job #3236490)
Utilizator | Data | 29 iunie 2024 01:26:18 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#pragma GCC optimize ("03,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main(int argc, char const *argv[])
{
long long int sol = 0;
int p;
fin>>p;
if( p == 0 )
{
fout<<1;
return 0;
}
for(int i=1;i<=p;i++){
sol+=5;
int j=i;
while(j%5==0){
i++;
j/=5;
}
}
fout<<sol;
return 0;
}