提交记录 21759


用户 题目 状态 得分 用时 内存 语言 代码长度
c_cpp_a 1003. 测测你的二分查找 Accepted 100 505.3 us 12 KB C++14 297 B
提交时间 评测时间
2024-05-10 14:57:20 2024-05-10 14:57:22
unsigned r,l=0,mid;
int binary_search(const unsigned *a, int n, unsigned x)
{
	if(a[l]==x){
		return l;
	} else if(a[l]<x){
		r=n,++l;
	} else{
		r=l-1,l=0;
	}
	while(l<r){
		mid=(l+r)>>1;
		if(a[mid]<x){
			l=mid+1;
		} else if(a[mid]>x){
			r=mid-1;
		} else{
			return mid;
		}
	}
	return l;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1505.3 us12 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2024-09-08 09:58:21 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用