题目大意:按照他的那个创造数组的方式,数第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;
}