Cod sursa(job #2233420)

Utilizator _ruthhhhhCapris Ruth _ruthhhhh Data 23 august 2018 11:30:58
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>

using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");

int v[100000002];
int p;

int main()
{
       fin >> p;
       v[0] = 1;
       int poz = 1;
       long long nr = 5;
       while(poz <= p)
       {
           int exp;
           exp = 25;
           while(nr % exp == 0)
           {
                v[poz] == -1;
                poz ++;
                exp *= 5;
           }
           v[poz] = nr;
           nr += 5;
           poz ++;
       }
       fout << v[p];
       return 0;
}