提交记录 5841


用户 题目 状态 得分 用时 内存 语言 代码长度
bzy 1003. 测测你的二分查找 Runtime Error 0 12.33 us 12 KB C++ 471 B
提交时间 评测时间
2018-09-03 22:19:56 2020-08-01 00:35:23
int binary_search(const unsigned *line, int ub, unsigned value){
register int down = 0,up=ub;
register int estimate = 0;
    while(1){
        estimate = down + 
        (unsigned long long)(up - down) *
        (value -line[down]) / (line[up] - line[down]);
        if(estimate == down) ++ estimate ;
        if(estimate == up  ) -- estimate ;
        if(line[estimate] == value)return estimate;
        (line[estimate] < value?down:up) = estimate;
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #112.33 us12 KBRuntime ErrorScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-04-11 04:55:53 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠