QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#702470 | #8081. Minimum Manhattan Distance | Nightsky | WA | 54ms | 3872kb | C++14 | 1.2kb | 2024-11-02 16:03:17 | 2024-11-02 16:03:18 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define fi first
#define se second
#define mkp make_pair
#define pb push_back
typedef pair <int, int> pii;
const long double PI = acos(-1);
inline ll read() {
ll x = 0, f = 0;
char c = getchar();
while (!isdigit(c)) {if (c == '-') f = 1; c = getchar();}
while (isdigit(c)) x = (x << 1) + (x << 3) + (c & 15), c = getchar();
return f? -x : x;
}
void getc(ll x1, ll y1, ll x2, ll y2, long double &x, long double &y, long double &r) {
x = (x1 + x2) / 2.0;
y = (y1 + y2) / 2.0;
r = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) / 2.0;
}
int main() {
/// freopen ("std.in", "r", stdin);
// freopen ("std.out", "w", stdout);
int T;
T = read();
while (T--) {
ll t1, t2, t3, t4;
long double x1, y1, r1, x2, y2, r2;
t1 = read(), t2 = read(), t3 = read(), t4 = read();
getc(t1, t2, t3, t4, x1, y1, r1);
t1 = read(), t2 = read(), t3 = read(), t4 = read();
getc(t1, t2, t3, t4, x2, y2, r2);
long double x = fabs(x2 - x1);
long double y = fabs(y2 - y1);
// x = x - r2 * cos(PI / 4.0);
// y = y - r2 * sin(PI / 4.0);
printf("%.10Lf", x + y - r2 * sqrt(2.0));
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3872kb
input:
1 0 0 2 1 4 5 5 2
output:
4.2639320225
result:
ok Your answer is acceptable!^ ^
Test #2:
score: -100
Wrong Answer
time: 54ms
memory: 3856kb
input:
100000 64184 -33682 59295 3067 16568 83379 -30901 17899 4747 16156 33365 80028 -41011 -93961 -89583 -95743 96914 -33206 12828 -88885 -93518 29681 -82022 42270 40225 76998 25677 84480 66361 -32945 94822 -81258 -17979 41800 -91442 80586 40229 -78184 30070 -89624 -21082 -94587 48262 -87979 -95197 91518...
output:
77664.4926864032192928.3027014407227607.1060353067145831.4445800460224138.5231894689203168.4163226262106258.7021872966114459.0303484890130191.378343408392639.9951336741110927.1824394682121482.2553263667130471.0514280389193239.8699309033101942.1776022450228879.0586081132128129.564658762783809.4379227...
result:
wrong output format Expected double, but "77664.4926864032192928.3027014...91562.08474742361638.9718864969" found