计算机学院大学生程序设计竞赛(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[ ...
随机推荐
- 数据库NULL和 ‘’ 区别
NULL判断时 : IS NOT NULL ''判断时: !=''
- xib storyboard
initWithNibName加载xib或者storyboard BLEViewController *controller = [[BLEViewController alloc] initWith ...
- english 释词
english 释词 [amount of & number of]the amount of /the number of指……的数量an amount of/a number of 指“大 ...
- 省市便利 UIPicherView
@property (strong,nonatomic) UIPickerView *pickerV; @property (strong,nonatomic) NSArray *arr; @prop ...
- 非常简单的oracle和mysql数据互传
工具是navicat,我用的是Navicat Premium 10: 这个工具可以同时连接mysql和oracle,如图: 同时连接上这两个库之后 工具->数据传输 左边是数据源,右边是导入目标 ...
- WPF(x:Null 使用)
<Window x:Class="TestOfNull.MainWindow" xmlns="http://schemas.microsoft.com/winfx/ ...
- ACE_Get_Opt解析命令行
ACE_Get_Opt是一种解析命令行参数选项的迭代器. 1:构造方法 ACE_Get_Opt需要引用头文件,#include "ace/Get_Opt.h". ACE_Get_O ...
- cell reuse & disposebag
For my project I've made base cell class TableViewCell: UITableViewCell { private(set) var disposeBa ...
- 80x86的3种工作方式
80x86中的32位CPU全面支持32位的数据.指令和寻址方式,提供了3种工作方式:是地址方式.保护方式和保护方式下的虚拟8086方式.在计算机上电或复位后,32位CPU首先初始化为是地址方式,再通过 ...
- ios 概况了解
iOS的系统架构分为四个层次:( iOS是基于UNIX内核,android是基于Linux内核) 核心操作系统层(Core OS layer).核心服务层(Core Services layer).媒 ...