不使用第三方变量求最大值

1、问题描述
There are two int variables: a and b, don't use "if", "?:", "switch" or other judgement statement, find

out the biggest one of the two numbers.

2、答案

int max = ((a+b) + abs(a-b)) / 2;
posted @ 2015-01-06 14:59  阿青1987  阅读(128)  评论(0编辑  收藏  举报