Cod sursa(job #1317461)
Utilizator | Data | 14 ianuarie 2015 22:00:05 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
using namespace std;
int nrcif(int n)
{
int cop=n,k=0;
while(cop==0)
{
k++;
cop=cop/10;
}
return k;
}
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int p,ult=1;
f>>p;
int ok=1,q=0;
while(ok)
{
q++;
ult=ult*q;
if(nrcif(ult)==p+1)
{
g<<q;
ok=0;
}
}
return 0;
}