#include <iostream> #include <iomanip> int main() { int n; std::cin >> n; // 拆分出百位、十位和个位 int hundreds = n / 100; int tens = (n / 10) % 10; int units = n % 10; // 计算结果 double result = static_cast<double>(hundreds + tens) / (tens + units); // 输出结果,保留两位小数 std::cout << std::fixed << std::setprecision(2) << result << std::endl; return 0; } /************************************************************** Problem: 1608 User: fuyijun Language: C++ Result: Accepted Time:6 ms Memory:2072 kb ****************************************************************/