CCPC_1005

可怕。。。。。的提。。。。。显而易见的规律活活没照出来。。。不过说起来却是不能严格证明。。。。于是。。。脑筋急转弯活活猜不出来。。。。。

1*1-》1*2-》2*2-》2*3-》3*3-》。。。。。。。-》愚蠢的自己

事后AC代码:

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 const long long MAXN=1e4+7333;
 4 double numb[MAXN];
 5 void init()
 6 {
 7     long long a=1,b=1;
 8     for(int i=4;i<MAXN;i+=2)
 9     {
10         numb[i]=a*b*2;
11         numb[i-1]=(numb[i-2]+numb[i])/2-0.5;
12         if(a==b)a++;
13         else b++;
14     }
15 }
16 int main()
17 {
18 
19     cin.sync_with_stdio(false);
20     init();
21     long long t;
22     cin>>t;
23     for(int i=0;i<t;++i)
24     {
25         double n;
26         cin>>n;
27         cout<<lower_bound(numb+4,numb+MAXN-23,n)-numb<<endl;
28     }
29     return 0;
30 }
原文地址:https://www.cnblogs.com/rikka/p/7397520.html