用户输出
-211 -888
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#47438 | #1138. ddd和鹦鹉 | Accepted | 100 | 172 ms | 356 K | C++ 11 / 736 B | 喵喵 | 2021-04-04 21:13:21 |
#include <bits/stdc++.h>
using namespace std;
const double inf = 99999999999.0;
double cal(int x1, int y1, int x2, int y2) {
double val;
val = 1.0 * sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
return val;
}
int main() {
int ax, ay, bx, by, cx, cy;
double dis = inf;
int ox, oy;
cin >> ax >> ay >> bx >> by >> cx >> cy;
int minx, miny, maxx, maxy;
minx = min(min(ax, bx), cx);
maxx = max(max(ax, bx), cx);
miny = min(min(ay, by), cy);
maxy = max(max(ay, by), cy);
for (int i = minx; i <= maxx; i++) {
for (int j = miny; j <= maxy; j++) {
double ndis = 3.0 * cal(i, j, ax, ay) + 2.0 * cal(i, j, bx, by) + 1.0 * cal(i, j, cx, cy);
// cout<<i<<" "<<j<<endl;
if (ndis < dis) {
dis = ndis;
ox = i, oy = j;
}
}
}
// cout<<minx;
cout << ox << " " << oy;
return 0;
}
用户输出
-211 -888
系统信息
Exited with return code 0
用户输出
143 999
系统信息
Exited with return code 0
用户输出
-498 -472
系统信息
Exited with return code 0
用户输出
408 403
系统信息
Exited with return code 0
用户输出
418 -178
系统信息
Exited with return code 0
用户输出
-188 -598
系统信息
Exited with return code 0
用户输出
-295 -813
系统信息
Exited with return code 0