ICPC 6918 And Or
来源:互联网 发布:网达软件工资水平 编辑:程序博客网 时间:2024/05/03 18:46
#include<iostream>#include<cstdio>using namespace std;#define ll long longlong long A,B;ll solve(ll x){ll cnt = 0;ll y = 1;while(x>=y){//cout<<"/////"<<endl;y = y<<1;++cnt;}return cnt;}int main(){ll T;scanf("%lld",&T);ll g = 1;while(T--){printf("Case %lld: ",g++);scanf("%lld%lld",&A,&B);ll x = solve(A);ll y = solve(B);ll ans2 = 0,ans1 = 0;if(x!=y)ans1 = (1ll<<y)-1; else {for(ll i=x-1;i>=0;i--){ll num1,num2;if(((A>>i)&1)==1)num1 = 1;else num1 = 0;if(((B>>i)&1)==1)num2 = 1;else num2 = 0;ll pp = (1ll<<i);if(num1!=num2){ans1= ans1+ (1ll<<(i+1))-1;break;}if(num1&&num2){ans1+=pp;ans2+=pp;}} }printf("%lld %lld\n",ans1,ans2);}return 0;}
0 0
- ICPC 6918 And Or
- and or
- AND & OR
- and ,or 和and-or
- python and or and-or
- UVALive 6918And Or(位运算)
- UVALive 6918 And Or 数学二进制+枚举
- UVALive 6918 And Or(位运算)
- icpc-beijing-cats and fish
- Python中的and、or、and-or
- 【转载】python 中的 and、or、and-or
- 条件or and并用
- or and test命令
- where and or
- and or join
- EXCEL IF AND OR
- python and or技巧
- and or技巧
- 正则表达式的搜索和替换
- fft
- 图片不能正常显示,显示默认图片。
- curl 命令的使用
- oracle的簇与簇表
- ICPC 6918 And Or
- 1184 -- ASCII码排序(2)
- OFDM之插入导频---802.11a
- YUM
- mysql性能优化-慢查询分析、优化索引和配置
- 计算机编程书单
- 1185 -- 6174问题
- 【翻译自mos文章】在windows上sqlplus / as sysdba 挂起
- 1186 -- 小学生算术