QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#224016#5471. Interactive Number Guessingfikusm9WA 0ms3424kbC++14635b2023-10-22 23:01:052023-10-22 23:01:06

Judging History

你现在查看的是最新测评结果

  • [2023-10-22 23:01:06]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3424kb
  • [2023-10-22 23:01:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int m,t,z,x=0;
bool bio=false;
long long d[20];
vector<int> v;

int binarna(int l, int r, int i)
{
	if(l==r) return 10-l;
	m=(l+r)/2;
	cout << "query" << m*d[i] << "\n";
	cin >> t; 
	if(t==z+m){
		return binarna(m,r,i);
	}
	else{
		return binarna(l,m,i);
	}
}


int main() {
	d[0]=1;
	for(int i=1; i<20; i++){
		d[i]=d[i-1]*10;
	}
	cout << "query" << 0 << "\n";
	cin >> z;
	for(int i=0; i<=18; i++){
		v.push_back(binarna(1,9,i));
	}
	for(int i=0; i<v.size(); i++){
		if(v[i]!=0) bio=true;
		if(bio) x+=v[i]*d[i];
	}
	cout << "answer" << x << "\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3424kb

input:


output:

query0

result:

wrong answer invalid type: query0