爱吃蛋炒饭。: 答案代码: 可以用 2 1 1.23 100 测试出答案是1.23,将下方代码的for循环中加个=即可,( i <= N - M) [code=java] double maxSum = 0; double minDifferValue = Double.MAX_VALUE; for (int i = 0; i < N - M; i++) { double sum = 0; double differValue = (i + M - 1) - (i); for (int j = 0; j < M; j++) { sum += (j + i); } if (differValue <= minDifferValue) { maxSum = sum; minDifferValue = differValue; } } (("%.2f", maxSum)); [/code]
c++获取线程id并转化为整数
2020国赛能力挑战赛java试题2-1