Cod sursa(job #2135431)

Utilizator stanbianca611Stan Bianca stanbianca611 Data 18 februarie 2018 20:34:55
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f ("factorial.in");
ofstream g ("factorial.out");
int main()
{
    int k=0, k2=0, k5=0, i=0, x, p,q, y;
    cin>>p;
    while (1>0)
    {
        i++; x=i;
        while(x%10==0)
        {
            k++; x=x/10;
        } y=x;
        while(x%2==0)
        {
            k2++; x=x/2;
        }
        x=y;
        while(x%5==0)
        {
            k5++; x=x/5;
        }
    if(k2>k5) q=k5;
    else q=k2;
    if(q+k==p) break;}
    cout<<i;
    return 0;
}