正确的姿势是 构造另一个点
k = (y2-y1)/(x2-x1)
-1/k = (x1-x2)/(y2-y1) 当x1 == x2 时特判。。
一时脑卡会想不到这个意外简单的性质。。
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <cassert>
#include <algorithm>
#include <cmath>
#include <set>
#include <list>
#include <map>
#include <limits>
using namespace std;
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define REP(i, s, t) for(int (i)=(s);(i)<=(t);++(i))
#define UREP(i, s, t) for(int (i)=(s);(i)>=(t);--(i))
#define REPOK(i, s, t, o) for(int (i)=(s);(i)<=(t) && (o);++(i))
#define MAXN 30000000
#define MAXM 999999
#define MOD 10000000000007
#define PI 3.1415926535897932384626433832795
#define INF 0x7FFFFFFF
typedef long long LL;
typedef vector<int> veci;
typedef pair<int, int> pairi;
int a[MAXN+5];
int main() {
freopen("input.in", "r", stdin);
int T, x1, y1, x2, y2;
int x3, y3, x4, y4;
cin >> T;
REP(kase, 1, T) {
cout << "Case " << kase << ": ";
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2) {
cout << "0 0 1 0" << '\n';
continue;
}
y4 = x1;
x4 = y2;
y3 = x2;
x3 = y1;
cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << '\n';
}
return 0;
}