Cod sursa(job #1490133)

Utilizator RazvanatorHilea Razvan Razvanator Data 22 septembrie 2015 19:34:19
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <fstream>

using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
    int p,n=1,c2=0,c5=0;
    f>>p;
    while (c2<p || c5<p) {
        int n1=n;
        while (n1%2==0) {
            c2++;
            n1/=2;
        }
        while (n1%5==0) {
            c5++;
            n1/=5;
        }
        n++;
    }
    g<<n;
}