编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#21482 | #1028. 小秋的完美数字 | Accepted | 100 | 11 ms | 3 K | C++ 17 / 418 B | Leohh | 2020-02-07 16:48:13 |
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {
int l = 1, r = 1e9, m, x;
while (true) {
m = (l + r) >> 1;
printf("%d\n", m);
fflush(stdout);
scanf("%d", &x);
if (x == 1) {
r = m - 1;
} else if (x == -1) {
l = m + 1;
} else {
break;
}
}
}