Cod sursa(job #1516248)

Utilizator dragos231456Neghina Dragos dragos231456 Data 2 noiembrie 2015 21:27:50
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    int n,p,i,w,s,t;
    ifstream f("fact.in");
    ofstream g("fact.out");
    f>>p;
    n=0;
    i=1;
    s=1;
    while(n<=5*p)
    {
       s=s*i;
       while(s%10==0)
       {
           s/=10;
           t+=1;
       }
       i+=1;
       if(t==p)break;
       n+=1;
    }
    n-=1;
    g<<n;
}