编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#21040 #1028. 小秋的完美数字 Accepted 100 10 ms 2 K C++ 11 / 569 B 钱91-夏泽 2019-12-02 18:26:41
显示原始代码
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
    int ini = 500000000, input = 0, high = 1000000000, low = 0;
    do {
        printf("%d\n", ini);
        fflush(stdout);
        scanf("%d", &input);
        if (input == 0)
            return 0;
        if (input == 1) {
            high = ini;
            if (ini == (high + low) / 2)
                ini--;
            else
                ini = (high + low) / 2;
        }
        if (input == -1) {
            low = ini;
            if (ini == (high + low) / 2)
                ini++;
            else
                ini = (high + low) / 2;
        }
    } while (true);
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:2 ms
内存:2 KiB

输入文件(data1.in

17

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:2 ms
内存:2 KiB

输入文件(data2.in

1

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:2 ms
内存:2 KiB

输入文件(data3.in

1000000000

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:2 ms
内存:2 KiB

输入文件(data4.in

154236798

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:2 ms
内存:2 KiB

输入文件(data5.in

114514

系统信息

Exited with return code 0