提交时间:2026-01-04 14:56:35

运行 ID: 80030

#include <iostream> #include <cmath> // 用于 sqrt 和 ceil 函数 #include <iomanip> // 用于调试输出,非必需 using namespace std; int main() { int n; cin >> n; double totalTime = 0.0; // 总时间(小数) for (int i = 0; i < n; i++) { double x, y; int p; // 人数 cin >> x >> y >> p; // 1. 计算距离 double distance = sqrt(x * x + y * y); // 2. 计算该屋顶所需时间:航行时间 + 上下船时间 double timeForOne = (2.0 * distance / 50.0) + (1.5 * p); // 3. 累加到总时间 totalTime += timeForOne; } // 4. 对总时间向上取整并输出整数 cout << ceil(totalTime) << endl; return 0; }