链接: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 671 纯洁的买卖:无限背包

    题目链接:https://www.rqnoj.cn/problem/671 题意: ALEJ要通过倒卖东西来赚钱. 现在他有m元经费. 有n种物品供他选择,每种物品数量无限. 第i件物品的买入价为c[ ...

  2. html5--1.9 img元素嵌入图片

    html5--1.9 img元素嵌入图片 学习要点: img元素嵌入图片学习一个新属性:title 1.img的属性 1.src:必要属性,制定图片来源的路径; 2.alt属性:当图片无法显示时的替代 ...

  3. navicat for mysql 安装

    直接上正题,用于记录 1.下载linux版本的navicat:http://www.navicat.com/download/navicat-for-mysql 2.解压 tar -vzxf navi ...

  4. linux应用之tomcat安装(centos)

    安装方式:源码安装 软件:apache-tomcat-7.0.29.tar.gz下载地址:http://tomcat.apache.org/download-70.cgi 安装前提 系统必须已经安装配 ...

  5. struts2框架xml验证

    struts2验证分为3步: 1.获取需要验证的信息,使用同名属性,提供getter,setter方法.然后框架使用反射将值自动注入. 2.对信息进行验证,成功失败作出对应的选择. xml验证和手动验 ...

  6. 基于django封装的常用装饰器和函数

    1:返回操作成功的json数据 def response_success(message, data=None, data_list=[]): return HttpResponse(json.dum ...

  7. MySQL 5.7新特性

    新增特性 Security improvements. MySQL.user表新增plugin列,且若某账户该字段值为空则账户不能使用.从低版本MySQL升级至MySQL5.7时要注意该问题,且建议D ...

  8. AtCoder Grand Contest 009 E:Eternal Average

    题目传送门:https://agc009.contest.atcoder.jp/tasks/agc009_e 题目翻译 纸上写了\(N\)个\(1\)和\(M\)个\(0\),你每次可以选择\(k\) ...

  9. bzoj 4032 [ HEOI 2015 ] 最短不公共子串 —— 后缀自动机+序列自动机

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4032 序列自动机其实就是每个位置记录一下某字母后面第一个出现位置,为了子序列能尽量长. 对字 ...

  10. bzoj 2865 字符串识别 —— 后缀数组

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2865 唯一出现的子串就是每个后缀除去和别的后缀最长的 LCP 之外的前缀: 所以用这个更新一 ...