Inter#Active. 交互题 ‌ ‌ ‌ ‌ ‌ ↓是A+B Problem,超简单的,推荐所有人去做

交互题 ‌ ‌ ‌ ‌ ‌ ↓是A+B Problem,超简单的,推荐所有人去做

题目背景

这是一道交互题。

题目描述

这道题要求你通过 ? a? b 读取 AABB,计算 A+BA+B 的值并通过 ! a+b 输出。

你可以发送 ? a 到标准输出,随后读入 AABB 同理。你最多发送 ? 开头的调用两次。随后你应该通过 ! a+b 输出你认为的 A+BA+B 的值。

说明/提示

对于 1%1\% 的分数,1A,B101\le A,B \le 10

对于 100%100\% 的分数,1A,B2×1061\le A,B \le 2\times {10}^6

提交模板:

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cout<<"? a"<<endl;
    cin>>a;
    cout<<"? b"<<endl;
    cin>>b;
    cout<<"! "<<a+b<<endl;
}