回复 9楼 buffer
我第15个就精度问题了...
OK!!!!!!!!
#include<cstdio>
#include<cstring>
#include<cmath>
const int num=249439;
int prime[22001]; //素数
bool boprime[num+1];
double f[num+1]; //斐波那契数列
double goldnum; //goldnum黄金分割比
int n;
void find()
{
//fill
memset(boprime,0,sizeof(boprime));
//find prime
prime[0]=2; prime[1]=3; prime[2]=4;
int i=2,j;
while (i<=num)
{
if (!boprime[i])
{
j=2*i;
while (j<=num)
{
boprime[j]=true;
j+=i;
}
if (i!=2 && i!=3)
prime[++prime[0]]=i;
}
i++;
}
}
void doit()
{
goldnum=(sqrt(5)-1)/2;
f[1]=f[2]=1;
for (int i=3;i<=83;i++) f[i]=f[i-1]+f[i-2];
for (int i=40;i<=83;i++) while (f[i]>=1000000000) f[i]/=10;
for (int i=84;i<=num;i++)
{
f[i]=f[i-1]/goldnum;
while (f[i]>=1000000000) f[i]/=10;
}
}
void init()
{
while (scanf("%d",&n)==1)
printf("%.lf\n",floor(f[prime[n]]));
}
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
find();
doit();
init();
return 0;
}