专栏文章
CF2109C2 题解
CF2109C2题解参与者 1已保存评论 0
文章操作
快速查看文章及其快照的属性,并进行相关操作。
- 当前评论
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @mip0x7nj
- 此快照首次捕获于
- 2025/12/03 04:21 3 个月前
- 此快照最后确认于
- 2025/12/03 04:21 3 个月前
我们小学二年级就学过,如果一个数是 的倍数,那么它的各位数字和也是 的倍数。
故我们先
再
再
此时我们再
由于此题是交互题,会有
故我们先
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;
}
相关推荐
评论
共 0 条评论,欢迎与作者交流。
正在加载评论...