用户输出
-211 -888
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#48711 | #1138. ddd和鹦鹉 | Accepted | 100 | 241 ms | 356 K | C++ / 1.1 K | JackRip | 2021-05-17 21:19:20 |
#include <bits/stdc++.h>
using namespace std;
namespace Tzh {
typedef pair<double, double> pa;
const double eps = 1e-5;
double sqr(double x) { return x * x; }
double dis(pa a, pa b) { return sqrt(sqr(a.first - b.first) + sqr(a.second - b.second)); }
inline pa operator-(const pa a, const pa b) { return pa(a.first - b.first, a.second - b.second); }
inline double cross(pa a, pa b) { return fabs(a.first * b.second - a.second * b.first); }
void work() {
pa a, b, c;
cin >> a.first >> a.second;
cin >> b.first >> b.second;
cin >> c.first >> c.second;
double p = dis(a, b) + dis(b, c) + dis(c, a);
p /= 2;
double s = sqrt(p * (p - dis(a, b)) * (p - dis(b, c)) * (p - dis(a, c)));
double ans = 1000000000;
pa pr;
for (int i = -1000; i <= 1000; i++)
for (int j = -1000; j <= 1000; j++) {
pa cur = pa(double(i), double(j));
double ts = cross(a - cur, b - cur) + cross(b - cur, c - cur) + cross(c - cur, a - cur);
ts /= 2;
if (fabs(ts - s) <= eps) {
double tmp;
tmp = dis(cur, a) * 3 + dis(cur, b) * 2 + dis(cur, c);
if (tmp < ans) {
ans = tmp;
pr = cur;
}
}
}
cout << int(pr.first) << " " << int(pr.second);
return;
}
} // namespace Tzh
int main() {
Tzh::work();
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