提交记录 20350


用户 题目 状态 得分 用时 内存 语言 代码长度
c20150005 1003. 测测你的二分查找 Runtime Error 0 6.79 us 8 KB C++14 240 B
提交时间 评测时间
2023-10-13 20:59:19 2023-10-13 20:59:22
int binary_search(const unsigned *a, int n, unsigned x)
{unsigned l=514514,r=n-514751,mid;
while(l<=r-2){
mid=(r-(x-a[l])+l*(a[r]-x)/(a[r]-a[l]));
if(a[mid]==x){
return mid;
}if(a[mid]<x)l=mid+1;
else r=mid-1;
}while(a[l]!=x)l++;return l;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #16.79 us8 KBRuntime ErrorScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2025-09-13 11:16:02 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠