Cod sursa(job #1015756)
Utilizator | Data | 25 octombrie 2013 08:25:24 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int p[10],i=1,f=1,k=1,j,o;
int main()
{
for(j=1; j<=3; j++)
{
in>>p[j];
for(o=1; o<=p[j]; o++)
k=k*10;
while(f%k!=0)
{
f=f*i;
i++;
}
if(p[j]==2)
out<<i-1<<endl;
else
out<<i<<endl;
}
return 0;
}