提交记录 21961


用户 题目 状态 得分 用时 内存 语言 代码长度
GalenoJiao 1003. 测测你的二分查找 Accepted 100 336.66 us 12 KB C++ 443 B
提交时间 评测时间
2024-07-19 11:04:56 2024-07-19 11:04:59
/*********************************************************************
    $AUTHOR$: GalenoJiao
    $DATETIME$: 2024/7/19 11:00:38
*********************************************************************/
int binary_search(const unsigned *a, int n, unsigned x){
	int l = -1, r = n;// a[0,l]<x a[r,n)>x
	while(r-l>1){
		int mid = (r+l)>>1;
		if(a[mid]==x){
			return mid;
		}else if(a[mid]>x){
			r = mid;
		}else{
			l = mid;
		}
	}
	return l;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1336.66 us12 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2024-10-18 14:51:00 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用