Cod sursa(job #2697082)
Utilizator | Data | 17 ianuarie 2021 17:28:25 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
unsigned long long i,fct=1,p,j,l;
in>>p;
l=pow(10,p);
for(i=1;i<=10000000;i++){
fct=1;
for(j=1;j<=i;j++)
fct=fct*j;
if(fct%l==0){
out<<i<<" ";
break;
}
}
return 0;
}