30分求救!!!样例什么的都过了(っ °Д °;)っ
查看原帖
30分求救!!!样例什么的都过了(っ °Д °;)っ
797187
Rorou楼主2023/8/14 08:27
#include<bits/stdc++.h>
using namespace std;
long long ans=0,t=0,k,T,n,x;
int main(){
	ios::sync_with_stdio(false);
	//cin.tie(0),cout.tie(0);
	cin>>T;
	while(T--){
		cin>>n>>x;
		ans=0,t=0,k=x;
		if(n==1||n==2){
				cout<<x<<'\n';
				continue;
		}
		if(x%2==0){
			while(x%2==0){
				t++;
				x/=2; 
			}
		//	cout<<"111 "<<x<<'\n';
			if(t+1==n){
				cout<<k<<'\n';
				continue;
			}
		}
		if(x%2==1){
		
			cout<<(x << n-2)<<'\n';
			continue;
		}
	}
	return 0;
}
2023/8/14 08:27
加载中...