Cod sursa(job #1512837)

Utilizator OFY4Ahmed Hamza Aydin OFY4 Data 28 octombrie 2015 18:29:49
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<fstream>
using namespace std;
int main(){
 
    ifstream fin("fact.in");
    ofstream fout("fact.out");
 
    unsigned long long n=0,p,i=1,temp;
 
    fin>>p;
 
    if(p==0){
 
        fout<<i;
    }
    else{
 
        do{
 
            n=n+5;temp=n;
 
            do{
                temp=temp/5;
 
                --p;
 
            }while(temp%5==0);
        }while(p>0);
 
        fout<<n;
    }
}