标签:rip 技术 return pre tput std string 编写 har


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
int f[22]={0,1,1};
for (int i = 3 ; i <= 20 ; i++)
f[i] = f[i-1] + f[i-2];
double n;
double a1 = log10(1.0 / sqrt(5));
double a2 = log10((1 + sqrt(5)) / 2);
while (cin>>n)
{
if (n <= 20)
{
cout<<f[(int)n]<<endl;
continue;
}
double ans = a1 + n * a2;
ans -= floor(ans);
ans = pow (10,ans);
ans = (int)(ans * 1000);
cout<<ans<<endl;
}
return 0;
}
标签:rip 技术 return pre tput std string 编写 har
原文地址:https://www.cnblogs.com/yelir/p/11588693.html