提交时间:2024-10-07 19:36:58

运行 ID: 52508

#include <iostream> #include <iomanip> int main() { int confirmed, deaths; double mortalityRate; std::cin >> confirmed >> deaths; if (confirmed == 0) { std::cout << "0.000" << std::endl; return 0; } mortalityRate = (static_cast<double>(deaths) / confirmed) * 100; std::cout << std::fixed << std::setprecision(3); std::cout << mortalityRate << "%" << std::endl; return 0; }