题解 | #小乐乐计算函数#
小乐乐计算函数
https://www.nowcoder.com/practice/89238e99c36e450786ccf3a9e7481b7b
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static double max3(int a, int b, int c) {
int maxNum = a;
maxNum = a > b ? a : b;
maxNum = maxNum > c ? maxNum : c;
return maxNum;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
double m = max3(a + b, b, c) /
(max3(a, b + c, c) + max3(a, b, b + c));
System.out.printf("%.2f",m);
}
}
