QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#302597 | #5471. Interactive Number Guessing | Urvuk3 | WA | 1ms | 3628kb | C++14 | 1.7kb | 2024-01-11 00:00:48 | 2024-01-11 00:00:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
#define fi first
#define se second
#define pii pair<int,int>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
//#define endl "\n"
#define pb push_back
void PRINT(int x) {cerr << x;}
void PRINT(ll x) {cerr << x;}
void PRINT(double x) {cerr << x;}
void PRINT(char x) {cerr << '\'' << x << '\'';}
void PRINT(string x) {cerr << '\"' << x << '\"';}
void PRINT(bool x) {cerr << (x ? "true" : "false");}
template<typename T,typename V>
void PRINT(pair<T,V>& x){
cerr<<"{";
PRINT(x.fi);
cerr<<",";
PRINT(x.se);
cerr<<"}";
}
template<typename T>
void PRINT(T &x){
int id=0;
cerr<<"{";
for(auto _i:x){
cerr<<(id++ ? "," : "");
PRINT(_i);
}
cerr<<"}";
}
void _PRINT(){
cerr<<"]\n";
}
template<typename Head,typename... Tail>
void _PRINT(Head h,Tail... t){
PRINT(h);
if(sizeof...(t)) cerr<<", ";
_PRINT(t...);
}
#define Debug(x...) cerr<<"["<<#x<<"]=["; _PRINT(x)
int Ask(ll a){
cout<<"query "<<a<<endl;
int r; cin>>r;
return r;
}
void Finish(ll x){
cout<<"answer "<<x<<endl;
}
void Solve(){
ll x=0,sum=Ask(0);
for(int i=1;i<=10;i*=10){
int res=0,l=1,r=9;
while(l<=r){
if(Ask(mid*i)-sum==mid){
res=mid;
l=mid+1;
}
else r=mid-1;
}
x+=(9-res)*i;
}
Finish(x);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t; t=1;
//cin>>t;
while(t--){
Solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3628kb
input:
6 11 4 12 11 13 5
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 answer 23
result:
wrong answer wrong guess: 23 actual: 123