系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#96505 | #1028. 小秋的完美数字 | Accepted | 100 | 23 ms | 400 K | C++ 11 / 571 B | 2216113072 | 2023-07-05 19:47:15 |
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
long long gus = 1e9 / 2, l = 1, r = 1e9;
cout << gus << endl;
fflush(stdout);
int chk;
while (1) {
cin >> chk;
if (chk == 0) {
return 0;
} else if (chk == -1) {
l = gus + 1;
gus = (l + r) / 2;
cout << gus << endl;
fflush(stdout);
} else {
r = gus - 1;
gus = (l + r) / 2;
cout << gus << endl;
fflush(stdout);
}
}
}