标签:
1 #pragma comment(linker, "/STACK:1024000000,1024000000") 2 #include<iostream> 3 #include<cstdio> 4 #include<cstring> 5 #include<cmath> 6 #include<math.h> 7 #include<algorithm> 8 #include<queue> 9 #include<set> 10 #include<bitset> 11 #include<map> 12 #include<vector> 13 #include<stdlib.h> 14 using namespace std; 15 #define ll long long 16 #define eps 1e-10 17 #define MOD 1000000007 18 #define N 1000000 19 #define inf 1e12 20 ll n; 21 ll f[N]; 22 void init(){ 23 f[1]=1; 24 f[2]=2; 25 for(ll i=3;i<N;i++){ 26 f[i]=f[i-2]+f[i-1]; 27 } 28 } 29 int main() 30 { 31 init(); 32 int t; 33 scanf("%d",&t); 34 while(t--){ 35 scanf("%I64d",&n); 36 ll sum=0; 37 ll i; 38 for(i=1;i<N;i++){ 39 sum+=f[i]; 40 if(sum>n){ 41 break; 42 } 43 } 44 if(n==1 || n==2){ 45 printf("1\n"); 46 continue; 47 } 48 printf("%I64d\n",i-1); 49 } 50 return 0; 51 }
标签:
原文地址:http://www.cnblogs.com/UniqueColor/p/5184845.html