QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#630677 | #9227. Henry the Plumber | rikka_lyly | WA | 0ms | 3740kb | C++20 | 1.3kb | 2024-10-11 19:56:11 | 2024-10-11 19:56:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define EPS 1e-6
#define int ll
ll square(int x)
{
return x * x;
}
void solve()
{
int x1, y1, z1;
cin >> x1 >> y1 >> z1;
int p1, q1;
cin >> p1 >> q1;
int x2, y2, z2;
cin >> x2 >> y2 >> z2;
int p2, q2;
cin >> p2 >> q2;
if((x1 - x2) * p1 + (y1 - y2) * q1 == 0 && (x1 - x2) * p2 + (y1 - y2) * q2)
{
cout << 2 << '\n';
return;
}
double xc = (x1 + x2) / 2.0, yc = (y1 + y2) / 2.0;
double r = sqrt(square(x1 - x2) + square(y1 - y2) + square(z1 - z2));
int b1 = x1 * p1 + y1 * q1, b2 = x2 * p2 + y2 * q2;
// cerr << b1 << " " << b2 << endl;
if(p1 * q2 == p2 * q1)
{
if(p1 * b2 != p2 * b1)
cout << 4 << '\n';
else
cout << 3 << '\n';
return;
}
double xp = 1.0 * (q2 * b1 - q1 * b2) / (p1 * q2 - p2 * q1);
double yp = 1.0 * (p2 * b1 - p1 * b2) / (q1 * p2 - q2 * p1);
if(hypot(xp - xc, yp - yc) <= r)
cout << 3 << '\n';
else
cout << 4 << '\n';
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t;
cin >> t;
while (t--)
{
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
2 -1 -1 3 1 1 2 2 3 2 2 5 5 1 3 0 7 6 -2 1 -2
output:
4 3
result:
ok 2 number(s): "4 3"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3740kb
input:
100 -13 -5 -7 -19 19 -19 -13 0 -7 15 -20 20 19 -17 18 20 -20 -1 18 -19 -18 15 -14 -19 18 19 -20 6 20 -19 -12 9 1 7 -16 -13 -14 -8 8 -13 -19 16 9 20 -19 19 -18 -11 19 -18 19 20 -8 12 20 -11 -9 18 -19 -18 8 11 -13 12 -18 18 13 8 4 -18 -16 20 17 -19 18 20 -18 -3 20 -19 -17 -20 -5 -18 -19 19 16 15 19 20...
output:
3 4 4 4 4 4 3 4 4 3 3 4 4 3 3 3 3 4 4 4 3 4 4 4 4 4 4 4 3 3 3 4 4 4 4 4 4 4 4 4 3 4 3 4 3 4 4 3 4 4 3 3 3 4 4 4 3 4 3 4 3 4 3 4 3 4 3 4 3 3 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 3 4 3 3 4 3 4 4 4 4 4 4 4 4 3
result:
wrong answer 1st numbers differ - expected: '4', found: '3'