1 /* 2 PROBLEM:CF 485C 3 AUTHER:Nicole 4 MEMO:位运算 二进制 5 */ 6 #include<cstdio> 7 int main() 8 { 9 int n; 10 scanf("%d",&n); 11 for (int i=1;i<=n;i++) 12 { 13 long long l,r; 14 scanf("%lld%lld",&l,&r); 15 long long x=1; 16 while (l<=r) 17 { 18 long long temp=l|x; 19 if (temp>r) break; 20 l=temp; 21 x=x<<1; 22 } 23 printf("%lld\n",l); 24 } 25 return 0; 26 }
时间: 2024-10-06 23:31:25