码迷,mamicode.com
首页 > 编程语言 > 详细

【算法】三值选中法

时间:2019-09-22 00:59:35      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:return   负数   nbsp   div   算法   har   lse   sharp   stat   

    private static int f(int a, int b, int c) {
		if ((b - a) * (a - c) >= 0) {
			return a;
		} else if ((a - b) * (b - c) >= 0) {
			return b;
		} else {
			return c;
		}
	}

 中间值与另外两个数的差之积为负数

【算法】三值选中法

标签:return   负数   nbsp   div   算法   har   lse   sharp   stat   

原文地址:https://www.cnblogs.com/LPworld/p/11565529.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!