系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#100281 | #1028. 小秋的完美数字 | Accepted | 100 | 22 ms | 384 K | C++ 17 / 463 B | Dytchem | 2023-07-11 18:15:19 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int L = 1, R = (int)1e9;
while (abs(L - R) > 1) {
int mid = (L + R) / 2;
cout << mid << endl;
fflush(stdout);
int re;
cin >> re;
if (re == 1) {
R = mid;
} else if (re == -1) {
L = mid;
} else {
return 0;
}
}
cout << L << endl;
fflush(stdout);
int re;
cin >> re;
if (re == -1)
cout << ++L << endl;
else
return 0;
}