Cod sursa(job #2437535)

Utilizator onicUrsan Dragos onic Data 9 iulie 2019 18:15:36
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream o("fact.out");
int n,P,divs,n0;
long k;
int main()
{
f>>P;
    if(P==0)
    {
         cout<<1;
         return 0;
    }k=1;
    divs=25;
    while(P>n0)
    {
        n=k*5;
        if(n%divs==0)
        {
            n0++;
        }
        k++;
    n0++;
    }
    if(n0==P)
    o<<n0;
    else
    o<<-1;
    return 0;
}