系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22782 | #1028. 小秋的完美数字 | Accepted | 100 | 10 ms | 2 K | C++ / 829 B | 机类910-尚锦奥 | 2020-02-14 19:21:15 |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#define lson node << 1
#define rson node << 1 | 1
using namespace std;
#define ll long long
const ll maxn = 5e5 + 10;
ll read() {
char c = getchar();
ll x = 0;
ll flag = 1;
while (c < '0' || c > '9') {
if (c == '-')
flag = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - 48;
c = getchar();
}
x *= flag;
return x;
}
int l = 1, r = 1e9;
int x;
int main() {
while (1) {
int mid = (l + r) >> 1;
printf("%d\n", mid);
fflush(stdout);
scanf("%d", &x);
if (x == 1) {
r = mid - 1;
} else if (x == -1) {
l = mid + 1;
} else
break;
}
// printf("%d",l);
return 0;
}