poj2624

简单题

View Code
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
using namespace std;

struct Point
{
double x, y;
} point[5];

void input()
{
for (int i = 1; i < 4; i++)
scanf("%lf%lf", &point[i].x, &point[i].y);
if (point[1].x != point[2].x || point[1].y != point[2].y)
swap(point[2], point[3]);
if (point[1].x != point[2].x || point[1].y != point[2].y)
swap(point[0], point[1]);
if (point[1].x != point[2].x || point[1].y != point[2].y)
swap(point[2], point[3]);
}

void work()
{
Point p;
p.x = (point[0].x + point[3].x) / 2 - point[1].x;
p.y = (point[0].y + point[3].y) / 2 - point[1].y;
printf("%.3f %.3f\n", point[1].x + p.x * 2, point[1].y + p.y * 2);
}

int main()
{
//freopen("t.txt", "r", stdin);
while (~scanf("%lf%lf", &point[0].x, &point[0].y))
{
input();
work();
}
return 0;
}

posted @ 2011-10-03 17:37  金海峰  阅读(169)  评论(0编辑  收藏  举报