有点换算疑问
left: 3 right: 4
代入int mid = left + (right - left) / 2;是int mid = 3 + (4 - 3) / 2;
不是3+0.5=3.5吗?
怎么变换成mid = (3 + 4) / 2 = 3这个结构的呀?
而且mid = (3 + 4) / 2 = 3也等于3.5
是要向下去整吗?
left: 3 right: 4
代入int mid = left + (right - left) / 2;是int mid = 3 + (4 - 3) / 2;
不是3+0.5=3.5吗?
怎么变换成mid = (3 + 4) / 2 = 3这个结构的呀?
而且mid = (3 + 4) / 2 = 3也等于3.5
是要向下去整吗?
2023-11-15
举报