Cod sursa(job #3201595)
Utilizator | Data | 9 februarie 2024 09:20:27 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
long long int n,p,x=0;
fin>>n;
if(n==0)
fout<<1;
else
{
while(n!=0)
{
x=x+5;
if(x%25==0)
n=n-pow(2,x/25);
else if(x%5==0 || x%10==0)
n--;
}
fout<<x;
}
}