提交时间:2025-12-05 15:34:07
运行 ID: 75224
#include <iostream> #include <cmath> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<pair<pair<double, double>, int>> roofs(n); for (int i = 0; i < n; ++i) { double x, y; int people; cin >> x >> y >> people; roofs[i] = {{x, y}, people}; } // 按距离大本营排序 sort(roofs.begin(), roofs.end(), [](const auto& a, const auto& b) { return hypot(a.first.first, a.first.second) < hypot(b.first.first, b.first.second); }); double total_time = 0; for (const auto& roof : roofs) { double distance = hypot(roof.first.first, roof.first.second); total_time += 2 * distance / 50 + roof.second + 0.5 * roof.second; } // 向上取整 cout << static_cast<int>(ceil(total_time)) << endl; return 0; }