QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#472183 | #6412. Classical Geometry Problem | lllei# | WA | 1ms | 3884kb | C++20 | 2.9kb | 2024-07-11 14:55:51 | 2024-07-11 14:55:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using A = array<double, 3>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while (T--) {
int x, y, z;
cin >> x >> y >> z;
auto len = [&](A a, A b) {
return sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) + (a[2] - b[2]) * (a[2] - b[2]));
};
auto check = [&](int x) {
return x == 255 || x == 0;
};
if (check(x) && check(y) && check(z)) {
cout << 1 << '\n';
cout << x << ' ' << y << ' ' << z << ' ';
cout << fixed << setprecision(10) << len(A{x, y, z}, A{0, 0, 0}) << '\n';
continue;
}
A a0{x, y, z}, a1, a2;
bool flag1 = 0, flag2 = 0;
auto print = [&](A a) {
if (flag1) {
cout << fixed << setprecision(10) << a[0] << ' ' << a[2] << ' ' << a[1];
} else if (flag2) {
cout << fixed << setprecision(10) << a[2] << ' ' << a[1] << ' ' << a[0];
} else {
cout << fixed << setprecision(10) << a[0] << ' ' << a[1] << ' ' << a[2];
}
};
auto get1 = [&](A a) {
double x = 255 - 255 * (255 - a[0]) / (255 - a[2]);
double y = 255 - 255 * (255 - a[1]) / (255 - a[2]);
return A{x, y, 0};
};
auto get2 = [&](A a) {
double x = 255 - 255 * (255 - a[0]) /(255 - a[1]);
return A{x, 0, 0};
};
auto get3 = [&](A a) {
double y = 255 - 255 * (255 - a[1]) / (255 - a[0]);
return A{0, y, 0};
};
auto print1 = [&](A a, A b) {
cout << fixed << setprecision(10) << len(a, b);
};
a1 = get1(a0);
if (a1[0] <= 255 && a1[0] >= 0 && a1[1] >= 0 && a1[1] <= 255) {
} else {
swap(a0[1], a0[2]);
a1 = get1(a0);
if (a1[0] <= 255 && a1[0] >= 0 && a1[1] >= 0 && a1[1] <= 255) {
flag1 = 1;
} else {
swap(a0[1], a0[2]);
swap(a0[0], a0[2]);
a1 = get1(a0);
flag2 = 1;
}
}
a2 = get2(a1);
bool flag3 = 0;
if (a2[0] >= 0 && a2[0] <= 255) {
} else {
flag3 = true;
a2 = get3(a1);
}
cout << 3 << '\n';
if (flag3) {
print(A{0, 255, 0});
} else {
print(A{255, 0, 0});
}
cout << ' ';
print1(a2, A{0, 0, 0});
cout << '\n';
print(A{255,255, 0});
cout << ' ';
print1(a2, a1);
cout << '\n';
print(A{255, 255, 255});
cout << ' ';
print1(a1, a0);
cout << '\n';
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3884kb
input:
3 105 255 175 174 174 174 0 0 0
output:
3 0.0000000000 255.0000000000 0.0000000000 255.0000000000 0.0000000000 255.0000000000 255.0000000000 119.0000000000 255.0000000000 255.0000000000 255.0000000000 119.0000000000 3 255.0000000000 0.0000000000 0.0000000000 0.0000000000 255.0000000000 255.0000000000 0.0000000000 0.0000000000 255.00000000...
result:
wrong output format Expected integer, but "0.0000000000" found (test case 1)