第一行包含三个空格分隔的整数,分别是服务中心数量、包裹总数
(
),以及配送机器人的平均速度 speed(
,单位 km/h)。 接下来的
行,每行包含两个实数
和
(
),表示每个包裹在地图上的公里坐标。
输出一个整数,表示完成任务所需的总时间(秒)。结果请向下取整。
2 3 36 3.0 4.0 6.0 8.0 0.0 5.0
1710
在本样例中,,机器速速度为 36 km/h。 1. 包裹到原点的距离分别为 5.0, 10.0, 5.0。排序后选择坐标 (3,4) 为中心 0,(0,5) 为中心 1。 2. 经过聚类迭代,中心 0 最终更新为 (4.5, 6.0),中心 1 为 (0.0, 5.0)。 3. 两个服务点到原点距离分别为 7.5 和 5.0。访问顺序为 (0,0) -> (0,5) -> (4.5, 6) -> (0,0)。 4. 总路径长度约为 5 + 4.6098 + 7.5 = 17.1098 km。 5. 总耗时约为
秒,向下取整得 1710。
3 10 30 1.2 1.5 1.8 1.2 5.0 5.2 5.5 4.8 4.9 5.5 -2.0 3.0 -2.5 3.5 -1.8 2.8 1.5 1.8 5.2 5.0
2502
For 3 communities, 10 packages, and speed 30 km/h, the 10 packages are clustered into 3 centers. Sorted by distance to the origin, the centers are approximately (1.5, 1.5), (-2.1, 3.1), and (5.15, 5.125). The total distance traversed visiting them in order and returning to the origin takes approximately 2502 seconds (floor applied). Note: if K >= N, all N points become their own cluster centers.

这道题你会答吗?花几分钟告诉大家答案吧!