Cod sursa(job #705963)
Utilizator | Data | 5 martie 2012 11:37:26 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main(void)
{
fstream f,g;
f.open("fact.in",ios::in);
g.open("fact.out",ios::out);
int n=1,i,imp1=25,pas=0;
long long p=1;
f>>p;
if(p==0)
g<<1;
else
{
n=p*5;
while(n>imp1)
{
pas++;
imp1*=(pas+1);
}
n-=pas*5;
g<<n;
}
}