Codeforces Round #388 (Div. 2) B

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 xi and 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

题意:告诉我们平行四边形三个点,让求最后一个点

解法:

1 当然也会存在三个点

2 我们这样..

  y3-(y1+y2)/2得出到对角线的距离 

 我们求对角线的另外一点(y1+y2)/2+(y1+y2)/2-y3==y1+y2-y3

3 好了,应该发现这个规律应该是,,,,yi+yj-yz和xi+xj-xz(i,j,z<=3)

复制代码
 1 #include<bits/stdc++.h>
 2 typedef long long LL;
 3 typedef unsigned long long ULL;
 4 typedef long double LD;
 5 using namespace std;
 6 #define debug(x) cout << #x" = " << x<<endl;
 7 struct Node{
 8     int x,y;
 9 }node[100];
10 int main(){
11     for(int i=1;i<=3;i++){
12         cin>>node[i].x>>node[i].y;
13     }
14     cout<<"3"<<endl;
15     cout<<node[1].x+node[2].x-node[3].x<<" "<<node[1].y+node[2].y-node[3].y<<endl;
16     cout<<node[2].x+node[3].x-node[1].x<<" "<<node[2].y+node[3].y-node[1].y<<endl;
17     cout<<node[1].x+node[3].x-node[2].x<<" "<<node[1].y+node[3].y-node[2].y<<endl;
18     return 0;
19 }
复制代码

 

posted @   樱花落舞  阅读(231)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示