当前位置: 首页 > news >正文

遵义县住房和城乡建设局网站建设银行网站用户名

遵义县住房和城乡建设局网站,建设银行网站用户名,制作手机网站用什么软件,企业营销网站制作CF1790E Vlad and a Pair of Numbers 题解题目链接字面描述题面翻译题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1思路代码实现题目 链接 https://www.luogu.com.cn/problem/CF1790E 字面描述 题面翻译 共有 ttt 组数据。 每组数据你会得到一个正整数 xxx… CF1790E Vlad and a Pair of Numbers 题解题目链接字面描述题面翻译题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1思路代码实现题目 链接 https://www.luogu.com.cn/problem/CF1790E 字面描述 题面翻译 共有 ttt 组数据。 每组数据你会得到一个正整数 xxx你需要构造一组正整数 aaa 和 bbb满足 abx×2a b x \times 2abx×2 axor⁡bxa \operatorname{xor} b xaxorbx其中 xor⁡\operatorname{xor}xor 指异或。 输出你构造的 aaa 和 bbb。如有多解任意输出一解即可。如无解输出 −1-1−1。 1≤t≤1041 \leq t \leq 10^41≤t≤1041≤x≤2291 \leq x \leq 2^{29}1≤x≤229。同时你需要保证你构造的 aaabbb 满足 1≤a,b≤2301 \leq a,b \leq 2^{30}1≤a,b≤230。 题目描述 Vlad found two positive numbers $ a $ and $ b $ ( $ a,b0 $ ). He discovered that $ a \oplus b \frac{a b}{2} $ , where $ \oplus $ means the bitwise exclusive OR , and division is performed without rounding… Since it is easier to remember one number than two, Vlad remembered only $ a\oplus b $ , let’s denote this number as $ x $ . Help him find any suitable $ a $ and $ b $ or tell him that they do not exist. 输入格式 The first line of the input data contains the single integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases in the test. Each test case is described by a single integer $ x $ ( $ 1 \le x \le 2^{29} $ ) — the number that Vlad remembered. 输出格式 Output $ t $ lines, each of which is the answer to the corresponding test case. As the answer, output $ a $ and $ b $ ( $ 0 a,b \le 2^{32} $ ), such that $ x a \oplus b \frac{a b}{2} $ . If there are several answers, output any of them. If there are no matching pairs, output -1. 样例 #1 样例输入 #1 6 2 5 10 6 18 36样例输出 #1 3 1 -1 13 7 -1 25 11 50 22思路 根据题目 ab2x和aab2x和aab2x和a xorxorxor bxbxbx 我们能发现一个非常高重要的突破点a异或b流失了xa异或b流失了xa异或b流失了x ∴a按位与bx/2a按位与bx/2a按位与bx/2 ∵题目可输出任意解 ∴ax/2,bxx/2ax/2,bxx/2ax/2,bxx/2 但我们还要考虑一个无解的情况 当x是奇数时无法被2整除无解 当(x/2)按位与x!0(x/2)按位与x!0(x/2)按位与x!0有误无解 OK过程理完上代码 代码实现 #includebits/stdc.h using namespace std;int t,n; int main(){scanf(%d,t);while(t--){scanf(%d,n);if(n%21){printf(-1\n);continue;}if(((n/2)n)!0){printf(-1\n);continue;}printf(%d %d\n,n/2,n/2n);}return 0; }
http://www.hkea.cn/news/14552428/

相关文章:

  • wordpress做淘宝客可以加入apiseo免费工具
  • 网站识别手机电脑代码网页设计与网站建设 设计题
  • wordpress全站启用ssl张戈哪个网站做推广比较好
  • 企业网站建设报价表120平方装修预算表
  • 电商网站 建社区上海外贸展
  • 福州专业网站建设怎么做wordpress怎么换中文字体
  • 网络公司做机场网站紫金论坛最新新闻事件
  • 怎么用电脑做网站虚拟空间wordpress 淘宝客 采集
  • 西安千叶网站建设做环球资源网站有没有效果
  • 手机版网站建设合同范本企业展示型网站php
  • 建设专门网站 强化信息宣传wordpress 改网站介绍
  • 购物网站开发思路贸易公司网站建
  • 环保业网站建设的策划怎么做网站文章优化
  • 公司网站开发多少钱网站 运营
  • 深圳品牌营销网站建设如何获取免费域名
  • 手机好在百度做网站吗wordpress打字烟花
  • 惠州网站建设 翻译工业风格装修效果图
  • 怎样利用网站做推广苏州建站推广定制
  • 自己怎么建网站抚顺网站推广
  • 外贸app网站开发思淘网站建设
  • 好用的网站建设工具学生网站建设可行性分析
  • 企业单位网站怎么做开发电子商务网站的主流语言
  • 网站设计的初衷重庆必玩景点排名
  • 华强北ic网站建设嘉定注册公司
  • 版面设计素材厦门网站优化公司
  • 企业网站栏目设置深圳市南山区住房和建设局网站官网
  • 加强网站建设工作总结空间网页版
  • 深圳微信网站运营网页版微信无法登陆
  • 徐州专业制作网站网站广告尺寸
  • asp.net网站建设ppt网站建设销售怎样