#include <iostream> #include <iomanip> int main() { int x, y, z; // 输入三科成绩 std::cin >> x >> y >> z; // 计算总分 int totalScore = x + y + z; // 计算平均分 double averageScore = static_cast<double>(totalScore) / 3; // 输出总分 std::cout << totalScore << std::endl; // 输出平均分,保留一位小数 std::cout << std::fixed << std::setprecision(1) << averageScore << std::endl; return 0; } /************************************************************** Problem: 1602 User: fuyijun Language: C++ Result: Accepted Time:6 ms Memory:2072 kb ****************************************************************/