计算机学院大学生程序设计竞赛(2015’12) 1005 Bitwise Equations
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std; const int maxn=;
long long X,K;
long long basex[maxn];
long long basek[maxn];
int totx,totk; int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%lld%lld",&X,&K); totx=totk=;
memset(basex,,sizeof basex);
memset(basek,,sizeof basek); while(X)
{
basex[totx++]=X%;
X=X/;
}
while(K)
{
basek[totk++]=K%;
K=K/;
} int now=;
for(int i=;i<totk;i++)
{
for(int j=now;;j++)
{
if(basex[j]==)
{
basex[j]=basek[i];
now=j+;
break;
}
else
{
basex[j]=;
now=j+;
}
}
}
for(int i=now;i<=;i++)
if(basex[i]==) basex[i]=; long long ans=;
for(int i=;i<=;i++) ans=ans+(long long)(basex[i]*pow(2.0,i));
printf("%lld\n",ans);
}
return ;
}
计算机学院大学生程序设计竞赛(2015’12) 1005 Bitwise Equations的更多相关文章
- 计算机学院大学生程序设计竞赛(2015’11)1005 ACM组队安排
1005 ACM组队安排 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Pro ...
- hdu 计算机学院大学生程序设计竞赛(2015’11)
搬砖 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submissi ...
- 计算机学院大学生程序设计竞赛(2015’12)Study Words
Study Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- 计算机学院大学生程序设计竞赛(2015’12)Polygon
Polygon Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Su ...
- 计算机学院大学生程序设计竞赛(2015’12)The Country List
The Country List Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 计算机学院大学生程序设计竞赛(2015’12) 1008 Study Words
#include<cstdio> #include<cstring> #include<map> #include<string> #include&l ...
- 计算机学院大学生程序设计竞赛(2015’12) 1009 The Magic Tower
#include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using ...
- 计算机学院大学生程序设计竞赛(2015’12) 1006 01 Matrix
#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> ...
- 计算机学院大学生程序设计竞赛(2015’12) 1003 The collector’s puzzle
#include<cstdio> #include<algorithm> using namespace std; using namespace std; +; int a[ ...
随机推荐
- iptables防火墙详解
iptables常用命令 iptables -nv -L 查看iptables列表 iptables -F 清空iptables规则 iptables-save > /etc/sysconfig ...
- 以excel方式输出数据
主类Test: public class D201 {//get set 方法略去 private String d201_01; private String d201_02; private St ...
- java regex possissive relunctant
Java正则表达中Greedy Reluctant Possessive 的区别 分类: java 2015-01-16 00:28 1588人阅读 评论(9) 收藏 举报 正则表达式Java 目录( ...
- Drivers Dissatisfaction
Drivers Dissatisfaction time limit per test 4 seconds memory limit per test 256 megabytes input stan ...
- js框架——angular.js(2)
1. 模块的利用扩充 模块的名称也可以当做变量使用,例如: <body ng-app> <label><input type="checkbox" n ...
- 学习笔记——适配器模式Adapter
适配器模式适用于将不一致的接口转换为一致的接口. 比如,去香港玩儿,带上了自己的笔记本电脑,结果晚上插电时就抓瞎了,电源插孔与插座不一致.WTF…… 插座是酒店装好的,不可能拆了换一个,电源是自己的, ...
- thinkPHP17---操作绑定到类
首先要配置: "ACTION_BIND_CLASS"=>"TRUE"; 控制器类的定义如下: namespace Home\Controller\Inde ...
- CodeForces 678D Iterated Linear Function
简单矩阵快速幂. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm& ...
- [转]solr DataImportHandler 解决mysql 表导入内存溢出问题
最近一个项目要用到solr做全文检索,开始盲人摸象. 用tomcat 7 开始配置,开始正常,但是遇到cookie里有中文就报错. 无奈,换tomcat 6, 结果DataImportHandler ...
- 把APP做成libary的注意事项
首先把build.gradle(app里的),里面改成这样 apply plugin: 'com.android.library'然后删掉applicationId这一行 注意,千万不能用注解,要把所 ...