题目来源:https://codeforces.com/contest/1167/problem/B

题意:互动题,给你6个数字分别为4 8 15 16 23 42,给你四次询问的机会,每一次询问你可以给出i,j判题机可以给你返回ai*aj,让你在四次询问之内得出6个数的位置。

思路:先询问a1*a2,a1*a3,a4*a5,a4*a6,这就可以确定三个数的位置,全排列一遍验证答案。

参考代码:

#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define PII pair<int,int>
#define PB push_back
#define POP pop_back
#define FI first
#define SE second
#define endl '\n'
#define ls x<<1
#define rs x<<1|1
const int N=3e6+7,mod=1e9+7,INF=1e9;
int ans[10] = {0,4,8,15,16,23,42};

int main()
{
    int a, b, c, d;
    cout << "? 1 2" << endl;
    cin>>a;
    cout << "? 1 3" << endl;
    cin>>b;
    cout << "? 4 5" << endl;
    cin>>c;
    cout << "? 4 6" << endl;
    cin>>d;
    sort(ans+1,ans+7);
    do
    {
        if(ans[1]*ans[2] == a && ans[1]*ans[3] == b && ans[4]*ans[5] == c && ans[4]*ans[6] == d)
        {
            cout << "! " << ans[1] << " " << ans[2] << " " << ans[3] << " " << ans[4] << " " << ans[5] << " " << ans[6] << endl;
            return 0;
        }
    }
    while(next_permutation(ans+1,ans+7));
    return 0;
}

附上cf前几次的一道互动题:https://codeforces.com/gym/101021/problem/A