Pagini recente » Cod sursa (job #3001675) | Diferente pentru problema/entropy intre reviziile 9 si 10 | Cod sursa (job #1416202) | Cod sursa (job #3289275) | Cod sursa (job #3253900)
//
// main.cpp
// fact
//
// Created by Andrada Minca on 05.11.2024.
//
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int p,s,i;
int main() {
fin>>p;
int k=1,kk=5;
for(i=1;i<=p;i++)
{
s+=5;
if(i%kk==0){i+=k;k++;kk*=5;}
}
if(s==0)fout<<1;
else if(i==p+1) fout<<s;
else fout<<-1;
return 0;
}