Cod sursa(job #1498230)
| Utilizator | Data | 8 octombrie 2015 10:21:18 | |
|---|---|---|---|
| Problema | Factorial | Scor | 15 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <iostream>
#include <fstream>
using namespace std;
int prim(int a,int b){
while(a!=b){
if(a>b) a=a-b;
else b=b-a;
}
return a;}
int main()
{
fstream f,g;
f.open("fact.in",ios::in);
g.open("fact.out",ios::out);
int n,p=1,q,nr=0,n2=0,n5=0;
f>>n;
while(nr!=n){
q=p;
while(q%2==0){
q=q/2;
n2++;}
while(q%5==0){
q=q/5;
n5++;
}
if(n2>n5) nr=n5;
else nr =n2;
p++;}
g<<p-1;
}
