Cod sursa(job #13445)

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

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