Cod sursa(job #2293550)

Utilizator ZePimpPotatoeAliuta Robert ZePimpPotatoe Data 1 decembrie 2018 02:34:07
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <fstream>
#include <iostream>
using namespace std;
int main(){
    ifstream f("fact.in");
    ofstream g("fact.out");
    unsigned long long a,i,b=1;
    f>>a;
    for(i = 1;;i++){
        b*=i;
        unsigned long long c=b;
        int q = 0;
        while(c%10==0){
            if(c%10==0)
                q++;
            c/=10;
        }
        if(q==a)
            break;
    }
    cout<<i;

}