Cod sursa(job #1516157)

Utilizator dragos231456Neghina Dragos dragos231456 Data 2 noiembrie 2015 19:33:00
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 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)
    {
       t=0;
       s=s*i;
       w=s;
       while(w%10==0)
       {
           w/=10;
           t+=1;
       }
       i+=1;
       n+=1;
       if(t==p)break;

    }
    g<<n;
}