Cod sursa(job #13458)

Utilizator the_dragon_of_rockTzogorean Alex the_dragon_of_rock Data 6 februarie 2007 18:35:34
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include<fstream>
using namespace std;
long int n,p,m,q;

int main()
{
    ifstream in("fact.in");
    in>>p;
    n=0;
    int k=2;
    q=0;
    m=5;
    while(q<p)
        {
            n=n+5;
            if ((n/25)%5==0)
               q=q+3;
            else
               if ((n/5)%5==0)
                   q=q+2;
               else
                   q++;
        } 
    ofstream out("fact.out");
    if (p==0)
       out<<1;
    else 
        out<<n;

    return 0;
}