QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#788419 | #6620. Linear Fractional Transformation | Loxilante | WA | 167ms | 3892kb | C++20 | 1.2kb | 2024-11-27 16:51:55 | 2024-11-27 16:51:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long double db;
const db PI = acos(-1.0);
struct Complex {
db x, y;
Complex(db _x = 0.0, db _y = 0.0) {
x = _x;
y = _y;
}
Complex operator - (const Complex& b) const {
return Complex(x - b.x, y - b.y);
}
Complex operator + (const Complex& b) const {
return Complex(x + b.x, y + b.y);
}
Complex operator * (const Complex& b) const {
return Complex(x * b.x - y * b.y, x * b.y + y * b.x);
}
Complex operator / (const Complex& p) const {
db a = x, b = y, c = p.x, d = p.y;
return Complex((a * c + b * d) / (c * c + d * d), (b * c - a * d) / (c * c + d * d));
}
bool operator == (const Complex& b) const {
return x == b.x && y == b.y;
}
void input() {
scanf("%Lf%Lf", &x, &y);
}
void output() {
printf("%.10Lf %.10Lf\n", x, y);
}
}z[5], w[5];
int main() {
int T;
cin >> T;
while (T--) {
for (int i = 1; i <= 3; i++) {
z[i].input();
w[i].input();
}
z[4].input();
Complex r = ((z[4] - z[1]) * (z[3] - z[2]) * (w[3] - w[1])) / ((z[4] - z[2]) * (z[3] - z[1]) * (w[3] - w[2]));
r = (w[1] - r * w[2]) / (Complex(1, 0) - r);
r.output();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3884kb
input:
2 -1 0 0 -1 0 1 -1 0 1 0 0 1 0 -1 -1 0 -1 0 0 1 0 -1 1 0 1 0 0 -1
output:
1.0000000000 0.0000000000 0.0000000000 1.0000000000
result:
ok 4 numbers
Test #2:
score: -100
Wrong Answer
time: 167ms
memory: 3892kb
input:
100000 0 0 -1 1 1 1 1 0 1 0 1 -1 -1 0 -1 -1 -1 1 1 -1 1 -1 -1 0 1 0 -1 -1 -1 -1 0 -1 -1 1 -1 -1 0 -1 0 0 1 1 1 0 0 -1 0 0 0 0 -1 -1 1 0 1 1 -1 -1 0 -1 0 1 1 -1 1 0 -1 -1 1 -1 0 1 1 -1 1 0 1 0 0 -1 0 1 -1 -1 1 1 -1 1 0 0 -1 -1 0 1 0 1 1 0 1 1 1 -1 0 1 -1 -1 1 0 -1 0 1 -1 1 0 -1 1 -1 -1 1 0 0 -1 0 1 0...
output:
1.0000000000 1.6666666667 -1.0000000000 1.0000000000 -1.5000000000 -0.5000000000 0.3333333333 -0.6666666667 -0.3846153846 -0.9230769231 -1.0000000000 -0.0000000000 -1.5000000000 0.5000000000 -0.8536585366 -0.3170731707 -1.3333333333 0.3333333333 0.1724137931 -0.0689655172 -nan -nan -0.6666666667 -1....
result:
wrong output format Expected double, but "-nan" found