提交记录 13018


用户 题目 状态 得分 用时 内存 语言 代码长度
top_secret 1003. 测测你的二分查找 Compile Error 0 0 ns 0 KB C++ 334 B
提交时间 评测时间
2020-07-19 11:09:06 2020-08-01 03:02:54
int binary_search(const unsigned *a, int n, unsigned X)
{
register unsigned *L = a, *R = a + (100000000 - 1);
register unsigned long long x = X;
	while(L<R){
register int md = ((R - a) * (x - *L) + (L - a) * (*R - x)) / (*R - *L);
if(a[md] == x) return md; else if(a[md] < x) L = a + (md + 1); else R = a + (md - 1);
}
return L - a;
}

CompilationN/AN/ACompile ErrorScore: N/A


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