题目描述
blablabla
样例
blablabla
算法1
(暴力枚举)
打表得出nice的stair数规律,算出来即可
时间复杂度
参考文献
C++ 代码
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e9;
typedef pair<int,int> pii;
int t;
vector<ll> ans;
void solve()
{
ll sum = 1;
ll p = 1;
while (sum <= 1e18&&sum>0) {
ll temp = sum * (sum + 1) / 2;
if(temp<1e18&&temp>0)
ans.push_back(temp);
else
break;
p <<= 1;
sum += p;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed;
solve();
cin >> t;
while(t--){
ll x;
cin >> x;
int path = 0;
for (auto item : ans) {
x -= item;
if (x < 0)
break;
path++;
}
cout << path << endl;
}
}