QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#630686 | #9227. Henry the Plumber | rikka_lyly | WA | 1ms | 3712kb | C++20 | 1.3kb | 2024-10-11 19:59:16 | 2024-10-11 19:59:18 |
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)) / 2;
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: 3708kb
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: 0
Accepted
time: 0ms
memory: 3584kb
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:
4 4 4 4 4 4 3 4 4 4 3 4 4 3 3 4 3 4 4 4 4 4 4 4 4 4 4 4 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 3 4 3 4 4 4 3 4 4 4 4 4 4 4 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 4 4 3 3 4 3 4 4 4 4 4 4 4 4 4
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
100 20 -9 -19 9 13 -12 14 -18 -17 12 2 -3 -2 2 -19 -8 9 -15 -19 3 -16 -16 -18 2 15 19 17 -6 -10 11 14 -20 -6 -19 7 -17 -8 -1 -7 -15 7 -15 3 2 13 -15 -9 11 15 2 -17 20 13 11 -8 -12 18 16 -18 -17 -17 15 -2 -20 1 8 -6 0 -16 -19 -5 -14 16 -17 10 -7 -16 17 -10 -13 1 1 -13 17 11 -3 -3 -18 4 -17 19 -6 -17 ...
output:
3 4 4 4 3 3 4 3 3 4 4 3 4 4 3 3 4 3 4 4 4 4 3 4 3 4 4 3 3 4 4 4 3 4 3 3 4 3 3 4 3 4 3 4 3 4 3 4 4 3 3 4 3 3 4 3 3 4 4 3 3 4 4 3 4 3 3 4 3 3 3 4 3 4 3 4 3 4 3 4 4 3 3 4 3 4 4 4 4 3 3 3 3 4 3 3 4 4 4 4
result:
ok 100 numbers
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3708kb
input:
100 10 -9 -13 8 -7 -3 3 -15 -5 11 -14 -20 -17 13 -13 3 20 16 -20 8 -2 -15 -20 8 20 20 -10 15 12 6 4 2 20 14 14 -13 6 -20 -10 20 -18 -15 19 10 9 4 18 -11 -16 -15 20 -11 6 15 -10 -17 -19 -6 -6 8 -19 -19 -18 -11 -9 -6 4 18 11 -5 2 -18 20 0 -12 -10 -18 -17 20 -20 19 19 17 2 -11 -20 2 -16 -19 13 -6 6 -5 ...
output:
4 3 4 3 4 4 3 2 3 4 4 3 3 3 4 4 3 3 3 4 4 4 3 4 3 3 3 3 4 4 3 4 4 3 4 3 3 4 4 3 3 3 4 4 3 4 4 4 4 4 3 4 3 4 4 4 3 4 4 3 4 4 3 3 3 4 3 3 3 3 4 4 4 4 3 4 4 3 4 3 4 3 3 3 4 4 3 4 3 4 4 3 4 3 4 4 3 3 4 4
result:
wrong answer 8th numbers differ - expected: '3', found: '2'