系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#46648 | #1028. 小秋的完美数字 | Accepted | 100 | 14 ms | 360 K | C++ 17 / 497 B | 计试001-顾真榕 | 2020-10-16 9:33:02 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int h = 1, t = 1e9, mid = (h + t) / 2;
printf("%d\n", mid);
fflush(stdout);
int temp;
scanf("%d", &temp);
while (temp != 0) {
if (temp == -1) {
h = mid + 1;
mid = (h + t) / 2;
}
if (temp == 1) {
t = mid;
mid = (h + t) / 2;
}
printf("%d\n", mid);
fflush(stdout);
scanf("%d", &temp);
}
}