5 条题解
-
-4
a = list(map(int, input().split())) key = int(input()) cnt=0 n=len(a) i=0;j=(len(a)-1)//2 while i<=j: m=(i+j)//2 cnt=cnt+1 if a[m]==key: break elif a[m]<key: i=m+1 else: j=m-1 if i<=j: print("YES") print(cnt) else: if a[-i]==key: cnt=cnt+1 print("YES") print(cnt) else: print("NO")
😄
信息
- ID
- 804
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- 递交数
- 1144
- 已通过
- 216
- 上传者