Cod sursa(job #1166831)

Utilizator LarryIulian Dutu Larry Data 3 aprilie 2014 20:52:47
Problema Factorial Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <fstream>
using namespace std;
 
int main()
{
    unsigned P,z=0,i,a;
    ifstream f("fact.in");
    f>>P;
    f.close();
    for(i=5;z<P;i+=5)
    {
        a=i;
        while(a%5==0)
        {
            z++;
            a/=5;
        }
    }
    ofstream g("fact.out");
    if(P==0)
        i=2;
    if(z==P)
        g<<i-5;
    else
        g<<-1;
    g.close();
    return 0;
}