題目大意:按照他的那個創造數組的方式,數第k個數是幾。
思路:看他給的數組例子,會發現奇數時都是1,當去處1時奇數又都是2了,以此類推。
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#define ll long long
using namespace std;
int n;
ll k, cnt = 0;
int main()
{
cin >> n >> k;
while(k)
{
cnt++;
if(k % 2)
{
cout << cnt << endl;
return 0;
}
k /= 2;
}
cout << cnt << endl;
return 0;
}