题意:https://codeforc.es/contest/1207/problem/E

答案guessing(0~2^14-1)

有两次机会,内次必须输出不同的100个数,每次系统会随机挑一个你给的数,告诉你答案XOR这个数的值。

问你这个答案是多少。

思路:

先输出100个前7位位0的数,再输出100个后7位为0的数,计算即可。

  1. #define IOS ios_base::sync_with_stdio(0); cin.tie(0);
  2. #include <cstdio>//sprintf islower isupper
  3. #include <cstdlib>//malloc exit strcat itoa system("cls")
  4. #include <iostream>//pair
  5. #include <fstream>//freopen("C:\\Users\\13606\\Desktop\\草稿.txt","r",stdin);
  6. #include <bitset>
  7. //#include <map>
  8. //#include<unordered_map>
  9. #include <vector>
  10. #include <stack>
  11. #include <set>
  12. #include <string.h>//strstr substr
  13. #include <string>
  14. #include <time.h>//srand(((unsigned)time(NULL))); Seed n=rand()%10 - 0~9;
  15. #include <cmath>
  16. #include <deque>
  17. #include <queue>//priority_queue<int, vector<int>, greater<int> > q;//less
  18. #include <vector>//emplace_back
  19. //#include <math.h>
  20. //#include <windows.h>//reverse(a,a+len);// ~ ! ~ ! floor
  21. #include <algorithm>//sort + unique : sz=unique(b+1,b+n+1)-(b+1);+nth_element(first, nth, last, compare)
  22. using namespace std;//next_permutation(a+1,a+1+n);//prev_permutation
  23. #define fo(a,b,c) for(register int a=b;a<=c;++a)
  24. #define fr(a,b,c) for(register int a=b;a>=c;--a)
  25. #define mem(a,b) memset(a,b,sizeof(a))
  26. #define pr printf
  27. #define sc scanf
  28. #define ls rt<<1
  29. #define rs rt<<1|1
  30. typedef long long ll;
  31. void swapp(int &a,int &b);
  32. double fabss(double a);
  33. int maxx(int a,int b);
  34. int minn(int a,int b);
  35. int Del_bit_1(int n);
  36. int lowbit(int n);
  37. int abss(int a);
  38. //const long long INF=(1LL<<60);
  39. const double E=2.718281828;
  40. const double PI=acos(-1.0);
  41. const int inf=(<<);
  42. const double ESP=1e-;
  43. const int mod=(int)1e9+;
  44. const int N=(int)1e6+;
  45.  
  46. int main()
  47. {
  48. int t,ans=;
  49. cout<<(<<)<<endl;
  50.  
  51. pr("? ");
  52. for(int i=;i<=;++i)
  53. pr("%d%c",i,i==?'\n':' ');
  54. fflush(stdout);
  55.  
  56. sc("%d",&t);
  57. for(int i=;i>=;--i)
  58. ans+=((t>>i)&)<<i;
  59.  
  60. pr("? ");
  61. for(int i=;i<=;++i)
  62. pr("%d%c",i<<,i==?'\n':' ');
  63. fflush(stdout);
  64.  
  65. sc("%d",&t);
  66. for(int i=;i>=;--i)
  67. ans+=((t>>i)&)<<i;
  68. pr("! %d\n",ans);
  69. return ;
  70. }
  71.  
  72. /**************************************************************************************/
  73.  
  74. int maxx(int a,int b)
  75. {
  76. return a>b?a:b;
  77. }
  78.  
  79. void swapp(int &a,int &b)
  80. {
  81. a^=b^=a^=b;
  82. }
  83.  
  84. int lowbit(int n)
  85. {
  86. return n&(-n);
  87. }
  88.  
  89. int Del_bit_1(int n)
  90. {
  91. return n&(n-);
  92. }
  93.  
  94. int abss(int a)
  95. {
  96. return a>?a:-a;
  97. }
  98.  
  99. double fabss(double a)
  100. {
  101. return a>?a:-a;
  102. }
  103.  
  104. int minn(int a,int b)
  105. {
  106. return a<b?a:b;
  107. }

XOR Guessing(交互题+思维)Educational Codeforces Round 71 (Rated for Div. 2)的更多相关文章

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

    Educational Codeforces Round 71 (Rated for Div. 2)-E. XOR Guessing-交互题 [Problem Description] ​ 总共两次询 ...

  2. Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块

    Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块 [Problem Description] ​ ...

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

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

  4. Educational Codeforces Round 71 (Rated for Div. 2) E XOR Guessing (二进制分组,交互)

    E. XOR Guessing time limit per test1 second memory limit per test256 megabytes inputstandard input o ...

  5. Educational Codeforces Round 71 (Rated for Div. 2)

    传送门 A.There Are Two Types Of Burgers 签到. B.Square Filling 签到 C.Gas Pipeline 每个位置只有"高.低"两种状 ...

  6. Educational Codeforces Round 71 (Rated for Div. 2) Solution

    A. There Are Two Types Of Burgers 题意: 给一些面包,鸡肉,牛肉,你可以做成鸡肉汉堡或者牛肉汉堡并卖掉 一个鸡肉汉堡需要两个面包和一个鸡肉,牛肉汉堡需要两个面包和一个 ...

  7. Educational Codeforces Round 71 (Rated for Div. 2)E. XOR Guessing

    一道容斥题 如果直接做就是找到所有出现过递减的不同排列,当时硬钢到自闭,然后在凯妹毁人不倦的教导下想到可以容斥做,就是:所有的排列设为a,只考虑第一个非递减设为b,第二个非递减设为c+两个都非递减的情 ...

  8. [贪心,dp] Educational Codeforces Round 71 (Rated for Div. 2) C. Gas Pipeline (1207C)

    题目:http://codeforces.com/contest/1207/problem/C   C. Gas Pipeline time limit per test 2 seconds memo ...

  9. [暴力] Educational Codeforces Round 71 (Rated for Div. 2) B. Square Filling (1207B)

    题目:http://codeforces.com/contest/1207/problem/B   B. Square Filling time limit per test 1 second mem ...

随机推荐

  1. 泛目录/泛目录程序/泛目录解析/莲花泛目录解析/寄生虫程序/黑帽SEO

    莲花泛目录程序强大之处: 蜘蛛抓取繁殖新页面,对搜索引擎更加友好采用PHP7语言开发,代码执行率高.蜘蛛抓取目录页面触发繁殖新页面,诱导搜索引擎爬虫爬行更多目录页面, 并且在本地生成缓存页面,搜索引擎 ...

  2. Jmeter(十四)取样器之JDBC Request

    在接口测试中,需要与数据库进行交互,这时候需要用到JDBC Request取样器. JDBC Request可以向数据库发送一个请求(sql语句),一般它需要配合JDBC Connection Con ...

  3. easyExcel简介#

    摘自:https://www.cnblogs.com/54chensongxia/p/11990312.html easyExcel简介# Java领域解析.生成Excel比较有名的框架有Apache ...

  4. Web服务器磁盘满深入解析及解决

    ########################################################## 硬盘显示被写满但是用du -sh /*查看时占用硬盘空间之和还远#小于硬盘大小问的 ...

  5. 根据需求定制 admin

    定义 list 页面 自定义 list_filter 首先,完成过滤器的功能,需要自定义过滤器.在 PostAdmin 定义的上方定义如下代码: class CategoryOwnerFilter(a ...

  6. Grafana添加Zabbix为数据源(二)

    接触过grafana的同学肯定会觉得grafana比zabbix的图像灵活好看很多,下面就让我们一起进行grafana的web界面配置 1.鼠标移动到左上角,点击Plugins,然后选择"c ...

  7. 基于Python使用scrapy-redis框架实现分布式爬虫

    1.首先介绍一下:scrapy-redis框架 scrapy-redis:一个三方的基于redis的分布式爬虫框架,配合scrapy使用,让爬虫具有了分布式爬取的功能.github地址: https: ...

  8. IDEA的热部署设置方式

    在这里只说一种简单的方式就是在idea中进行简单的设置就可以: 第一步:设置IDEA开启项目自动编译,进入设置找到Build,Execut, Deployment -> Compiler 勾选中 ...

  9. HashMap 怎么 hash?又如何 map?

    HashMap 是 Java 中 Map 的一个实现类,它是一个双列结构(数据+链表),这样的结构使得它的查询和插入效率都很高.HashMap 允许 null 键和值,它的键唯一,元素的存储无序,并且 ...

  10. Map构造器模式 map builder pattern

    maven引入依赖 <dependency> <groupId>com.google.guava</groupId> <artifactId>guava ...