QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#519528 | #8081. Minimum Manhattan Distance | Foedere0 | WA | 101ms | 4000kb | C++14 | 788b | 2024-08-14 20:49:01 | 2024-08-14 20:49:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define double long double
const int N = 1e6 + 9;
const int mod = 1e9 + 7;
#define inf 2e18
void solve()
{
int x11, x12, y11, y12, x21, x22, y21, y22;
cin >> x11 >> y11 >> x12 >> y12;
cin >> x21 >> y21 >> x22 >> y22;
double a = (x11 + x12) * 1.0 / 2, b = (y11 + y12) * 1.0 / 2;
double c = (x21 + x22) * 1.0 / 2, d = (y21 + y22) * 1.0 / 2;
double res = fabs(a - c) + fabs(b - d);
double s = sqrt((x22 - x21) * (x22 - x21) + (y21 - y22) * (y21 - y22)) * 1.0 / 2 * sqrt(2.000);
cout << fixed << setprecision(20) << res - s << '\n';
}
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int _ = 1;
cin >> _;
while (_--)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3916kb
input:
1 0 0 2 1 4 5 5 2
output:
4.26393202250021019495
result:
ok Your answer is acceptable!^ ^
Test #2:
score: -100
Wrong Answer
time: 101ms
memory: 4000kb
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:
-nan -nan 227607.10603530665684957057 -nan 224138.52318946886043704581 -nan -nan -nan 199492.59891428383161837701 -nan 110927.18243946823713486083 154352.40082280315800744575 130471.05142803890703362413 193239.86993090334362932481 -nan 263673.13461034390275017358 128129.56465876269066939130 83809.43...
result:
wrong output format Expected double, but "-nan" found