Cod sursa(job #3253901)
Utilizator | Data | 5 noiembrie 2024 11:32:48 | |
---|---|---|---|
Problema | Factorial | Scor | 90 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
//
// 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;
for(i=1;i<=p;i++)
{
s+=5;
int c=s/5;
while(c%5==0)
{
c/=5;
i++;
}
}
if(s==0)fout<<1;
else if(i==p+1) fout<<s;
else fout<<-1;
return 0;
}