Cod sursa(job #1114275)

Utilizator Isabela98fgvcvbcvbc Isabela98 Data 21 februarie 2014 14:16:25
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <fstream>
#include <climits>

using namespace std;
int zero (int n)
{
    int x, y, c=0;
    for (x=5; x<=n; x++)
    {y=x; while (y%5==0) {c++; y=y/5;}}
    return c;
}
int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    int n, p;
    f >> p;
    for (n=5*p; n<=INT_MAX; n++)
    {if (zero(n)==p) {g << n; break;}}
    return 0;
}