P11485 「Cfz Round 5」Non-breath Oblige 题解
题意
题目描述清晰,不多讲述。
结论
,都有 。 且 ,都有 ,其中 为最终的代价。
证明
若 ,那么答案为 。 若 ,如果我们要使 以及 的代价最小,那么我们将 变成 ,再将 变成 所需要的代价一定严格不大于其它 所花费的代价。
code
#include<bits/stdc++.h>
using namespace std;
signed main(){
int T,n,s,t;
for(cin>>T;T--;){
cin>>n>>s>>t;
if(s==t)puts("0");
else cout<<((1<<n)-1^s)+((1<<n)-1^t)<<'\n';
}
}