CF2109C2 题解
songtaoran · · 题解
我们小学二年级就学过,如果一个数是
故我们先 mul 9,此时数字的范围是
再 digit,此时数字的范围是
再 digit,就得到了
此时我们再 add n - 9 就好了。
由于此题是交互题,会有 ILE(Idleness limit exceeded)的情况:
- 不能用
\n!因为\n不刷新缓冲区! - 记得输入!
(好像没有人会犯这么弱智的错误)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll T, n, t;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin >> T;
while(T--){
cin >> n;
cout << "mul 9" << endl; cin >> t;
cout << "digit" << endl; cin >> t;
cout << "digit" << endl; cin >> t;
cout << "add " << n - 9 << endl; cin >> t;
cout << "!" << endl; cin >> t;
}
return 0;
}
提交记录