← 返回 atlassian 的题目列表Find Clustering Centers
类型:online_judge
atlassian
Given some points on a 2D plane, find the coordinates of clustering centers. The number of centers is specified by the user. Implement using the K-means algorithm.
Input:
The first line contains two integers, n and k, representing the number of points and the number of clustering centers.
The next n lines contain two integers each, representing the x and y coordinates of a point.
Output:
k lines, each containing two floating-point numbers, representing the coordinates of the clustering centers.
Constraints:
1 <= k <= n <= 1000
All coordinates are within the range [-10^4, 10^4].
Example:
Input:
5 2
1 2
3 4
5 6
7 8
9 10
Output:
4.0 5.0
7.0 8.0
Example
Input
5 2
1 2
3 4
5 6
7 8
9 10