Cod sursa(job #318594)
Utilizator | Data | 28 mai 2009 19:15:22 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
int p,n=0,e=1,i;
ifstream fin("fact.in");
fin>>p;
fin.close();
ofstream fout("fact.out");
if(p==0)n=1;
while(p)
{
for(i=1;i<=5;i++)
{
n+=5;p-=e;
}
e++;
}
fout<<n;
fout.close();
return 0;
}