文章
43
粉丝
180
获赞
21
访问
196.2k
#include <iostream>
using namespace std;
int res = 0x3f3f3f3f, x[10], y[10];
int main()
{
for (int i = 1; i <= 8; i ++ )
cin >> x[i] >> y[i];
for (int i = 1; i <= 8; i ++ )
for (int j = i + 1; j <= 8; j ++ )
if (abs(x[i] - x[j]) * abs(x[i] - x[j]) + abs(y[i] - y[j]) * abs(y[i] - y[j]) < res)
{
res = abs(x[i] - x[j]) * abs(x[i] - x[j]) + abs(y[i] - y[j]) * abs(y[i] - y[j]);
x[0] = i, y[0] = j;
}
cout << x[x[0]] << ' ' << y[x[0]] << endl << x[y[0]] << ' ' << y[y[0]];
return 0;
}
登录后发布评论
暂无评论,来抢沙发