【Codeforces Round #456 (Div. 2) B】New Year's Eve
【链接】 我是链接,点我呀:)
【题意】
【题解】
显然10000..取到之后 再取一个01111..就能异或成最大的数字了。【代码】
/*
1.Shoud it use long long ?
2.Have you ever test several sample(at least therr) yourself?
3.Can you promise that the solution is right? At least,the main ideal
4.use the puts("") or putchar() or printf and such things?
5.init the used array or any value?
6.use error MAX_VALUE?
7.use scanf instead of cin/cout?
8.whatch out the detail input require
*/
/*
一定在这里写完思路再敲代码!!!
*/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,k;
int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n >> k;
if (k==1){
cout << n << endl;
return 0;
}
ll cnt = 0,now = 1;
while (n){
cnt++;
n/=2;
now*=2;
}
cout << now-1<<endl;
return 0;
}