链接:https://codeforces.com/contest/1167/problem/B

题意:

This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You may also refer to the guide on interactive problems: https://codeforces.com/blog/entry/45307.

The jury guessed some array aa consisting of 66 integers. There are 66 special numbers — 44, 88, 1515, 1616, 2323, 4242 — and each of these numbers occurs in aa exactly once (so, aa is some permutation of these numbers).

You don't know anything about their order, but you are allowed to ask up to 44 queries. In each query, you may choose two indices ii and jj (1≤i,j≤61≤i,j≤6, ii and jj are not necessarily distinct), and you will get the value of ai⋅ajai⋅aj in return.

Can you guess the array aa?

The array aa is fixed beforehand in each test, the interaction program doesn't try to adapt to your queries.

交互题,根据你给的计算顺序来求他的原顺序。

思路:

得到1*2 2*3 3*4 4*5位置的值,然后直接枚举。

代码:

#include <bits/stdc++.h>
using namespace std; typedef long long LL; int A[10] = {0, 4, 8, 15, 16, 23, 42};
const int sum = 108;
map<int, int> ma;
int B[10]; bool check()
{
ma[4] = 1;
ma[8] = 2;
ma[15] = 3;
ma[16] = 4;
ma[23] = 5;
ma[42] = 6;
int tmp = 0;
for (int i = 1;i <= 5;i++)
{
if (ma[B[i]] == 0)
return false;
tmp += B[i];
}
B[6] = sum - tmp;
return true;
} int main()
{ int ab, bc, cd, de;
cout << '?' << ' ' << 1 << ' ' << 2 << endl;
fflush(stdout);
scanf("%d", &ab);
cout << '?' << ' ' << 2 << ' ' << 3 << endl;
fflush(stdout);
scanf("%d", &bc);
cout << '?' << ' ' << 3 << ' ' << 4 << endl;
fflush(stdout);
scanf("%d", &cd);
cout << '?' << ' ' << 4 << ' ' << 5 << endl;
fflush(stdout);
scanf("%d", &de);
for (int i = 1;i <= 6;i++)
{
if (ab % A[i] != 0)
continue;
B[1] = A[i];
B[2] = ab / B[1];
if (bc % B[2] != 0)
continue;
B[3] = bc / B[2];
if (cd % B[3] != 0)
continue;
B[4] = cd / B[3];
if (de % B[4] != 0)
continue;
B[5] = de / B[4];
if (check())
break;
}
fflush(stdout);
cout << '!' << ' ';
for (int i = 1;i <= 6;i++)
cout << B[i] << ' ' ;
cout << endl; return 0;
}

  

Educational Codeforces Round 65 (Rated for Div. 2) B. Lost Numbers的更多相关文章

  1. Educational Codeforces Round 65 (Rated for Div. 2)B. Lost Numbers(交互)

    This is an interactive problem. Remember to flush your output while communicating with the testing p ...

  2. Educational Codeforces Round 65 (Rated for Div. 2)题解

    Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...

  3. Educational Codeforces Round 65 (Rated for Div. 2) D. Bicolored RBS

    链接:https://codeforces.com/contest/1167/problem/D 题意: A string is called bracket sequence if it does ...

  4. Educational Codeforces Round 65 (Rated for Div. 2) C. News Distribution

    链接:https://codeforces.com/contest/1167/problem/C 题意: In some social network, there are nn users comm ...

  5. Educational Codeforces Round 65 (Rated for Div. 2) A. Telephone Number

    链接:https://codeforces.com/contest/1167/problem/A 题意: A telephone number is a sequence of exactly 11  ...

  6. [ Educational Codeforces Round 65 (Rated for Div. 2)][二分]

    https://codeforc.es/contest/1167/problem/E E. Range Deleting time limit per test 2 seconds memory li ...

  7. Educational Codeforces Round 65 (Rated for Div. 2)

    A:签到. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 ...

  8. Educational Codeforces Round 65 (Rated for Div. 2) E. Range Deleting(思维+coding)

    传送门 参考资料: [1]:https://blog.csdn.net/weixin_43262291/article/details/90271693 题意: 给你一个包含 n 个数的序列 a,并且 ...

  9. Educational Codeforces Round 65 (Rated for Div. 2)(ACD)B是交互题,不怎么会

    A. Telephone Number A telephone number is a sequence of exactly 11 digits, where the first digit is  ...

随机推荐

  1. RQNOJ 622 最小重量机器设计问题:dp

    题目链接:https://www.rqnoj.cn/problem/622 题意: 一个机器由n个部件组成,每一种部件都可以从m个不同的供应商处购得. w[i][j]是从供应商j处购得的部件i的重量, ...

  2. html5--1.10绝对路径和相对路径

    html5--1.10绝对路径和相对路径 学习要点: 绝对路径和相对路径 1.绝对路径 需要指出链接资源的绝对位置,与你的HTML文档的位置无关: 1. 服务器中的位置:href="http ...

  3. 分享知识-快乐自己:Oracle 创建序列 及 使用序列

    1.创建序列语法: create sequence 序列名 [可选参数] 序列名常定义为‘seq_XXX’的形式,创建序列不能使用replace 可选参数说明: increment by: 序列每次增 ...

  4. Zabbix监控华为交换机

    一.    监控交换机首先要在交换机开通snmp协议. 有两种方式开通,web界面,及交换机的配置界面 Web界面开通: 交换机配置界面 有web界面的,使用web界面相对简单,本项目就是用web界面 ...

  5. Java_Path_01_路径问题

    二.参考资料 1.java 路径问题 2.Java路径问题最终解决方案—可定位所有资源的相对路径寻址 3.Java获取文件的路径 4.Thread.currentThread().getContext ...

  6. [acm]HDOJ 1200 To and Fro

    题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=1200 简单字符串处理,找规律 /* 11509672 2014-08-21 11:32:55 Acc ...

  7. 查询oracle 数据库 SQL语句执行情况

    1.查看总消耗时间最多的前10条SQL语句 select *  from (select v.sql_id,  v.child_number,  v.sql_text,  v.elapsed_time ...

  8. 【LeetCode】040. Combination Sum II

    题目: Given a collection of candidate numbers (C) and a target number (T), find all unique combination ...

  9. CentOS6.6中安装VNC server(CentOS配置远程桌面)

    1.安装服务 yum install tigervnc-server 1 2 名字有点怪哦,CentOS5前叫vnc-server 2.运行并设置密码 vncserver + 回车 1 2 输入密码, ...

  10. Altium Designer如何从已有的PCB图中导出封装库

    1.打开PCB文件 2.选择  Design -> Make Integrated Library  (生成集成库) 注意,一定要在PCB 文件下  生成集成库!! 最终生成这个文件,打开这个文 ...