📄 2089.cpp
字号:
/* This Code is Submitted by wywcgs for Problem 2089 on 2005-10-03 at 15:59:38 */
#include <stdio.h>
#include <math.h>
typedef struct {
double x;
double y;
} Point;
int same(Point*, Point*);
int main()
{
Point a[2], b[2];
int sx, sy, flag;
double fx, fy;
while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
&a[0].x, &a[0].y, &a[1].x, &a[1].y, &b[0].x, &b[0].y, &b[1].x, &b[1].y) == 8) {
flag = 0;
for(sx = 0; sx < 2; sx++) {
for(sy = 0; sy < 2; sy++) {
if(same(&a[sx], &b[sy])) {
flag = 1;
break;
}
}
if(flag == 1) {
break;
}
}
fx = a[1-sx].x + b[1-sy].x - b[sy].x;
fy = a[1-sx].y + b[1-sy].y - b[sy].y;
if(fabs(fx) < 1e-4) {
fx = 0;
}
if(fabs(fy) < 1e-4) {
fy = 0;
}
printf("%.3lf %.3lf\n", fx, fy);
}
return 0;
}
int same(Point *x, Point *y)
{
if(fabs(x->x-y->x) < 1e-4 && fabs(x->y-y->y) < 1e-4) {
return 1;
} else {
return 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -