传送门

一道考验思维的交互题

大致思路就是从最高的二进制位向下询问

代入例子比如:

  5 6

  6 5

  7 4

  6 4

讨论一下

交互题的重点学会推理和归纳

 #include <bits/stdc++.h>
 using namespace std;

 int n, a, b;

 inline int ask(int c, int d) {
     printf("? %d %d\n", c, d);
     fflush(stdout);
     int rt; scanf("%d", &rt);
     return rt;
 }

 int main() {
     , );
     ; i >= ; --i) {
          << i), b), s = ask(a, b ^ ( << i));
         if (f == s) {
             ) a ^= ( << i);
              << i);
             big = f;
         }
         ) {
             a ^= ( << i), b ^= ( << i);
         }
     }
     printf("! %d %d\n", a, b);
     ;
 }

codeforces1088D_Ehab and another another xor problem交互题的更多相关文章

  1. E. XOR Guessing 交互题 Educational Codeforces Round 71 (Rated for Div. 2)

    E. XOR Guessing 交互题. 因为这个数最多只有14位 0~13,所以我们可以先处理后面7位,然后再处理后面7位. 因为异或的性质,如果一个数和0异或,那么就等于本身. 所以我们第一次异或 ...

  2. Codeforces.1088D.Ehab and another another xor problem(交互 思路)

    题目链接 边颓边写了半上午A掉啦233(本来就是被无数人过掉的好吗→_→) 首先可以\(Query\)一次得到\(a,b\)的大小关系(\(c=d=0\)). 然后发现我们是可以逐位比较出\(a,b\ ...

  3. Codeforces Round #525 (Div. 2) D. Ehab and another another xor problem(交互题 异或)

    题目 题意: 0≤a,b<2^30, 最多猜62次. 交互题,题目设定好a,b的值,要你去猜.要你通过输入 c d : 如果 a^c < b^d ,会反馈 -1 : 如果 a^c = b^ ...

  4. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem K. KMC Attacks 交互题 暴力

    Problem K. KMC Attacks 题目连接: http://codeforces.com/gym/100714 Description Warrant VI is a remote pla ...

  5. Codeforces Round #427 (Div. 2) E. The penguin's game (交互题,二进制分组)

    E. The penguin's game time limit per test: 1 second memory limit per test: 256 megabytes input: stan ...

  6. Codeforces 1137D - Cooperative Game - [交互题+思维题]

    题目链接:https://codeforces.com/contest/1137/problem/D 题意: 交互题. 给定如下一个有向图: 现在十个人各有一枚棋子(编号 $0 \sim 9$),在不 ...

  7. Gym - 101375H MaratonIME gets candies 交互题

    交互题介绍:https://loj.ac/problem/6 题意:输出Q X ,读入><= 来猜数,小于50步猜出就算过样例 题解:根本不需要每次输出要打cout.flush()... ...

  8. Codeforces Round #523 (Div. 2) F. Katya and Segments Sets (交互题+思维)

    https://codeforces.com/contest/1061/problem/F 题意 假设存在一颗完全k叉树(n<=1e5),允许你进行最多(n*60)次询问,然后输出这棵树的根,每 ...

  9. Codeforces Round #371 (Div. 2) D. Searching Rectangles 交互题 二分

    D. Searching Rectangles 题目连接: http://codeforces.com/contest/714/problem/D Description Filya just lea ...

随机推荐

  1. 装饰器&递归

    装饰器 1.开放封闭原则 ​ 在源码不改变的情况下,增加一些额外的功能 对扩展是开放的,对修改是封闭的 1.1 开放原则:增加额外新功能 1.2 封闭原则:不要改变源码 2 装饰器 满足开放封闭原则, ...

  2. POJ 2778:DNA Sequence(AC自动机构造矩阵)

    http://poj.org/problem?id=2778 题意:有m个病毒DNA,问构造一个长度为n的不带病毒DNA的字符串可以有多少种. 思路:看到这题有点懵,想了挺久题解的思路. 使用AC自动 ...

  3. HDU 3061:Battle(最大权闭合图)

    http://acm.hdu.edu.cn/showproblem.php?pid=3061 题意:中文题意. 思路:和上一题神似啊,比上一题还简单,重新看了遍论文让我对这个理解更加深了. 闭合图:如 ...

  4. elasticsearch与ms sql server数据同步

    MS SQL Server Download Elasticsearch Install Elasticsearch Follow instructions on https://www.elasti ...

  5. JAVA接口的继承与集合

    复习 20190701 接口补充 一. java是单继承多实现 单继承: 一个类只能有一个父类 public class D extends D1 { } 2. 多实现 一个类可以同时实现多个接口 当 ...

  6. Nginx+vsftpd

    一.安装Nginx 关闭selinux和firewalld setenforce sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selin ...

  7. LINUX安装源码软件经典三部曲

    这几天一直在搞suse下的mplyaer.ffmpeg等源码编译安装,总结出源码软件安装三部曲,网上称为经典三部曲. 这三步分别为: 1. ./configure [options] 2. make ...

  8. 20141209-基本概念-BlogEngine.NET(1)-笔记

    最近在读BlogEngine.NET3.1源代码,希望能坚持到底吧. 刚接触源代码,没有思路,于是读了14篇关于BlogEngine.Net1.4.5的系列博客,地址:http://www.cnblo ...

  9. 关于int和integer

    大家可以看一下下面这个java程序的运行结果 int k = 1; int l = 1; System.out.println(k == l); int a = 128; int b = 128; S ...

  10. Go语言解密上篇中用java aes实现的加密

    上一篇java aes文件加解密中加密的梅须逊雪三分白,雪却输梅一段香.使用go语言解密. 解密代码如下: AESUtil.go package util import ( "crypto/ ...