Cod sursa(job #625292)
Utilizator | Data | 24 octombrie 2011 10:43:36 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<fstream>
#include<iostream>
using namespace std;
int p,n=0;
int main(){
int i;
ifstream fin("fact.in");
fin>>p;
fin.close();
ofstream fout("fact.out");
i=0;
int x;
while(p!=0){
i+=5;
n+=5;
p-=1;
if(i%25==0){
x=i;
x=x/5;
while(x!=1){
x=x/5;
p--;}
}
}
fout<<n;
fout.close();
return 0;
}