| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 43299 | 123 | 【J】T2 | C++ | 解答错误 | 90 | 239 MS | 252 KB | 471 | 2026-10-28 15:06:12 |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll ans; void f(ll n,ll x){ ans=0; ll c=__builtin_popcount(x); if(n<=c){ cout<<x; return; } if((n-c)%2==0){ ans=x+(n-c); }else{ if(x==1)ans=n+3; if(x>1)ans=x+(n-c)+1; else{ if(n==1){ cout<<-1; return; } else ans=n+3; } } cout<<ans<<endl; } int main(){ ll t;cin>>t; while(t--){ ll n,x; cin>>n>>x; f(n,x); } return 0; }