time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output

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

【题目链接】:http://codeforces.com/contest/749/problem/B

【题解】



所给的是一个三角形的三个点;

枚举以哪一条边作为平行四边形的对边就好;

四边形的对边平分。

用中点公式就能推出第4个点的坐标;



【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%I64d",&x) typedef pair<int,int> pii;
typedef pair<LL,LL> pll; //const int MAXN = x;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0); struct abc
{
int x,y;
}; abc a[5];
abc ans[1000];
int k = 0; void tj(int a,int b)
{
k++;
ans[k].x = a;ans[k].y = b;
} int main()
{
//freopen("F:\\rush.txt","r",stdin);
rep1(i,1,3)
rei(a[i].x),rei(a[i].y);
int x1 = a[1].x,y1 = a[1].y,x2 = a[2].x,y2 = a[2].y,x3 = a[3].x,y3 = a[3].y;
int a = x1+x2-x3,b = y1+y2-y3;
tj(a,b);
a = x1+x3-x2,b = y1+y3-y2;
tj(a,b);
a = x3+x2-x1,b = y2+y3-y1;
tj(a,b);
printf("%d\n",k);
rep1(i,1,k)
printf("%d %d\n",ans[i].x,ans[i].y);
return 0;
}

【codeforces 749B】Parallelogram is Back的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  3. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  4. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  5. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  6. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

  7. 【Codeforces 429D】 Tricky Function

    [题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...

  8. 【Codeforces 670C】 Cinema

    [题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...

  9. 【codeforces 515D】Drazil and Tiles

    [题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...

随机推荐

  1. Linux 下的mysql+centos7+主从复制

    mysql+centos7+主从复制   MYSQL(mariadb) MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可.开发这个分支的原因之一是:甲骨文公 ...

  2. idea建立maven聚合项目 标签: mavenidea 2017-01-08 15:33 2477人阅读 评论(30)

    上篇文章写了如何用idea建立maven项目,idea建立maven聚合项目我感觉不如eclipse方便,不过并不是没有办法,下面写一下这个小教程. 建立maven project 建立maven p ...

  3. @codeforces - 702F@ T-Shirts

    目录 @description@ @solution@ @accepted code@ @details@ @description@ 有 n 件 T-shirt,第 i 件 T-shirt 有一个 ...

  4. PyTorch代码调试利器: 自动print每行代码的Tensor信息

    本文介绍一个用于 PyTorch 代码的实用工具 TorchSnooper.作者是TorchSnooper的作者,也是PyTorch开发者之一. GitHub 项目地址: https://github ...

  5. 如何使用jmeter调用soap协议

  6. 传说中Python最难理解的点|看这完篇就够了(装饰器)

    https://mp.weixin.qq.com/s/B6pEZLrayqzJfMtLqiAfpQ 1.什么是装饰器 网上有人是这么评价装饰器的,我觉得写的很有趣,比喻的很形象 每个人都有的内裤主要是 ...

  7. win10提示 磁盘包含不是“PARTITION_BASIC_DATA_GUID"类型的分区

    在win10创建新的磁盘分区的时候,有时候会提示 磁盘包含不是"PARTITION_BASIC_DATA_GUID"类型的分区 如果你试了其他方法都不凑效,那么看看你已经有几个盘( ...

  8. 第二次 C++作业

    1.为什么要用函数? 函数是相对独立的,经常使用的功能抽象化表现形式,函数的优势在于,编写之后可以被重复使用,使用时可以只关心函数的功能和使用方法而不必关心函数的具体实现,这样可以有利于代码重用,可以 ...

  9. 第三期 第三期 搜索——1.运动规划(motion_planing)

    运动规划的根本问题在于机器人可能存在于一个这样的世界中, 它可能想找到一条到达这个目标的路径,那么就需要指定一个到达那里的计划, 自动驾驶汽车也会遇到这个问题.他可能处于高速公路的附近的街道网络中,他 ...

  10. Laravel 之搜索引擎elasticsearch扩展Scout

    简介 Laravel Scout 是针对Eloquent 模型开发的一个简单的,基于驱动的全文检索系统.Scout 使用模型观察者时会自动保持你的检索索引与你的 Eloquent 记录同步. 目前,S ...