不得使用if-else或其他比较运算符 找出a、b中较大的数字

    技术2022-07-11  75

    面试题 16.07. 最大数值

    #include<math.h> int maximum(int a, int b){ // double c = a; // double d = b; // int res = (int) ((Math.abs(c-d) + c + d)/2); // return res; long c = a; long d = b; int res = (int) ((fabs(c-d) + c + d)/2); return res; } 链接:https://leetcode-cn.com/problems/maximum-lcci/solution/li-yong-shu-xue-si-wei-de-fang-fa-by-nhan/

     

    Processed: 0.009, SQL: 9