Pagini recente » Unlucky... | Cod sursa (job #1163363) | Cod sursa (job #1130797) | Cod sursa (job #2968814) | Cod sursa (job #548076)
Cod sursa(job #548076)
#include <iostream>
#include <fstream>
using namespace std;
int p,n;
int a[13]={0,25,125,625,3125,15625,78125,390625,1953125,9765625,48828125,244140625,1220703125};
int b[13]={0,6, 31,156, 781, 3906,19531, 97656, 488281,2441406,12207031, 61035156, 305175781};
int main ()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
int n=0,nr=1;
for (int i=0;i<=12;i++)
if (p==b[i]-1)
{
fout<<"-1";
nr=0;
}
/*if (nr)
{
if (p==0) fout<<"1";
else
{
int i=0;
while (p>b[i]) i++;
int s=a[i-1];
int d=p-b[i-1];
n=s+d*5;
fout<<n;
}
}*/
return 0;
}