题解:CF2109C3 Hacking Numbers (Hard Version)
气笑了。
C2 的
最后一步操作是没法得到信息的,我们至少必须在前两步得到足够的信息。
求数位和操作肯定是需要的,不然我们不可能将
如果一上来就求数位和,枚举下后面的步骤发现一定完蛋了。
第一步如果是加法或者除法,感觉对求数位和后的结果影响不大。
所以我们其实希望找到一个
那么怎么找呢?
直接搜索,小范围你发现
又因为
交,过了。
证明考虑,
不难发现用彩色线连起来的位置加和为
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int res=0;
cout<<"mul "<<999999999<<endl;
cin>>res;
cout<<"digit"<<endl;
cin>>res;
if(n!=81){
cout<<"add "<<n-81<<endl;
cin>>res;
}
cout<<"!"<<endl;
cin>>res;
}
return 0;
}