QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#211422#5471. Interactive Number Guessingbulijiojiodibuliduo#WA 1ms3776kbC++171.1kb2023-10-12 16:09:092023-10-12 16:09:10

Judging History

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

  • [2023-10-12 16:09:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3776kb
  • [2023-10-12 16:09:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int query(ll x) {
	printf("query %lld\n",x);
	fflush(stdout);
	int y;
	scanf("%d",&y);
	return y;
}
ll pw[111],x;
int main() {
	pw[0]=1;
	rep(i,1,19) pw[i]=pw[i-1]*10;
	int d=query(0);
	rep(i,0,2) {
		ll L=0,R=10;
		while (L+1<R) {
			int md=(L+R)/2;
			int d2=query(md*pw[i]);
			if (d2<d+md) R=md;
			else L=md;
		}
		x+=(9-L)*pw[i];
	}
	printf("answer %lld\n",x);
	fflush(stdout);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3776kb

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