Cod sursa(job #2372677)
Utilizator | Data | 7 martie 2019 10:30:51 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.27 kb |
#include <iostream>
#include <fstream>
using namespace std;
long long int p,x,z,y;
int main()
{ifstream f("fact.in");
ofstream g("fact.out");
f>>p;if(p==0) g<<1;
else{
x=0;
z=0;
while(p>0){
x=x+5;y=x;while(y%5==0){p--;y=y/5;} }
if(p==0) g<<x;
else g<<-1;
}}