系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#4650 | #1028. 小秋的完美数字 | Accepted | 100 | 22 ms | 5 K | C++ / 404 B | zz_ylolita | 2019-06-27 13:27:19 |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
int l, r, mid, x;
int main() {
l = 1;
r = 1e9;
while (l < r) {
mid = (l + r) >> 1;
cout << mid << endl;
fflush(stdout);
cin >> x;
if (x == 0)
return 0;
if (x == -1)
l = mid + 1;
else
r = mid - 1;
}
cout << r << endl; //注意二分的出口
fflush(stdout);
cin >> x;
return 0;
}