Untitled
unknown
plain_text
a year ago
696 B
3
Indexable
void Gojo(){
int n ,l ,r;cin>>n>>l>>r;
// int a[65]{};
int ans = l , OR = (l|n);
for(int i = l; i <= r; i++){
if((i|n) > OR){
ans = i;
OR = i|n;
}
}
cout << ans;
// return;
// for(int i = 64 ; i >= 0 ; i--){
// if(!knowBit(n,i)){
// a[i] ++;
// }
// }
// int sum = 0;
// for(int i = 64; i>= 0; i--){
// if( (a[i] && (sum + pow(2,i) <= r) ) || sum + pow(2,i) <= l){
// sum += pow(2,i);
// }
// }
// for(int i = 0; i <= 64 ; i++){
// if(sum < l && !a[i])sum += a[i];
// }
// cout << sum;
}Editor is loading...
Leave a Comment