题解 | #小乐乐计算函数#

小乐乐计算函数

https://www.nowcoder.com/practice/89238e99c36e450786ccf3a9e7481b7b

#include <stdio.h>
int max3(int a, int b, int c) {
    int max = a;
    if (max < b) {
        max = b;
    }
    if (max < c) {
        max = c;
    }
    return max;
}
int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int d = max3(a + b, b, c), e = max3(a, b + c, c), f = max3(a, b + c, c);
    float res = 1.0 * d / (e + f);
    printf("%0.2f", res);
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务