Codeforces 749B-Parallelogram is Back(CF水题)

                                     Parallelogram is Back

Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesian plane, that defined the set of vertices of some non-degenerate (positive area) parallelogram. Points not necessary were given in the order of clockwise or counterclockwise traversal.

Alex had very nice test for this problem, but is somehow happened that the last line of the input was lost and now he has only three out of four points of the original parallelogram. He remembers that test was so good that he asks you to restore it given only these three points.

Input

The input consists of three lines, each containing a pair of integer coordinates xiand yi ( - 1000 ≤ xi, yi ≤ 1000). It's guaranteed that these three points do not lie on the same line and no two of them coincide.

Output

First print integer k — the number of ways to add one new integer point such that the obtained set defines some parallelogram of positive area. There is no requirement for the points to be arranged in any special order (like traversal), they just define the set of vertices.

Then print k lines, each containing a pair of integer — possible coordinates of the fourth point.

Example

Input

0 0
1 0
0 1

Output

3
1 -1
-1 1
1 1

Note

If you need clarification of what parallelogram is, please check Wikipedia page:

https://en.wikipedia.org/wiki/Parallelogram

中文版题目:

很久以前Alex创造了一个关于平行四边形的有趣问题。该问题的输入数据包含笛卡尔平面上的四个整数点,它定义了一些非简并(正面积)平行四边形的顶点集。不必要的点按顺时针或逆时针遍历的顺序给出。亚历克斯对这个问题进行了非常好的测试,但不知怎的,输入的最后一行丢失了,而现在他只有原始平行四边形的四分之三。他记得测试非常好,只要给出这三点,他就会要求你恢复它。输入输入由三行组成,每行包含一对整数坐标xi和yi( - 1000≤xi,yi≤1000)。保证这三个点不在同一条线上,并且它们中没有两个重合。输出第一个打印整数k - 添加一个新整数点的方式的数量,使得获得的集合定义一些正面积的平行四边形。不需要以任何特殊顺序(如遍历)排列点,它们只是定义顶点集。然后打印k行,每行包含一对整数 - 第四点的坐标。示例输入0 0 1 0 0 1输出3 1 -1 -1 1 1 1注意如果您需要澄清平行四边形是什么,请查看维基百科页面:https://en.wikipedia.org/wiki/Parallelogram

题意:

实际上这一道题目问你的就是先让你输入三个不共线的点,然后输出有几种情况,使得另一个点可以和这三个点构成一个平行四边形,输出这几种情况下的这四个点的坐标.

思路:

实际上如果存在了三个点是不在同一个直线上的话,那么第四个点肯定有三种情况,那就直接按照平行四边形对边平行且相等来处理就可以了。

AC代码:

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <set>
 
using namespace std;
 
struct point//用坐标的话还是直接定义一个结构体比较方便 
{
	int x;
	int y;
}a[4];
 
int main()
{
    while(~scanf("%d %d",&a[0].x,&a[0].y))//这里开始把三组数据全部输入进来 
    {
        for(int i=1;i<3;i++)
            scanf("%d %d",&a[i].x,&a[i].y);
        printf("3\n");//只要是不共线的三个点他的情况肯定就是三种 
        printf("%d %d\n",a[1].x-a[0].x+a[2].x,a[1].y-a[0].y+a[2].y);
        printf("%d %d\n",a[2].x-a[1].x+a[0].x,a[2].y-a[1].y+a[0].y);
        printf("%d %d\n",a[0].x-a[2].x+a[1].x,a[0].y-a[2].y+a[1].y);
    }
    return 0;
}

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值