题意:
略。
题解:
其实是到大水题。
将序列反过来,下标从0开始。易证当x移动时,到2x+1的位置。
然后就没有了。
code:
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
LL n,q;
LL solve(LL k)
{
if((k&1)==0) return n-(k+2)/2+1;
return solve((k-1)/2);
}
int main()
{
scanf("%I64d %I64d",&n,&q);
for(int i=1;i<=q;i++)
{
LL k;scanf("%I64d",&k);
if(k&1) {printf("%I64d\n",(k+1)/2);continue;}
k=2LL*n-1-k;
printf("%I64d\n",solve(k));
}
}