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

题意:给定平行四边形的3个点,输出所有可能的第四个点。

思路:枚举任意两个点形成的直线,然后利用这两个点计算偏移量用第三点求出第四个点。

#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<time.h>
#include<cmath>
using namespace std;
typedef long long int LL;
int main(){
//#ifdef kirito
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
//#endif
// int start = clock();
pair<int, int>point[];
while (scanf("%d %d", &point[].first,&point[].second) != EOF){
scanf("%d %d", &point[].first, &point[].second);
scanf("%d %d", &point[].first, &point[].second);
set<pair<int, int>>ans;
for (int i = ; i <= ; i++){
for (int j = i + ; j <= ; j++){
pair<int, int>p4;
int k = - i - j; //非i,j的点
int dx = point[i].first - point[j].first;
int dy = point[i].second - point[j].second;
p4.first = point[k].first + dx;
p4.second = point[k].second + dy;
ans.insert(p4); p4.first = point[k].first - dx;
p4.second = point[k].second - dy;
ans.insert(p4);
}
}
printf("%d\n", ans.size());
for (set<pair<int,int>>::iterator it=ans.begin(); it!= ans.end(); it++){
printf("%d %d\n", it->first, it->second);
}
}
//#ifdef LOCAL_TIME
// cout << "[Finished in " << clock() - start << " ms]" << endl;
//#endif
return ;
}

Codeforces Round #388 (Div. 2) - B的更多相关文章

  1. Codeforces Round #388 (Div. 2)

      # Name     A Bachgold Problem standard input/output 1 s, 256 MB    x6036 B Parallelogram is Back s ...

  2. Codeforces Round #388 (Div. 2) - C

    题目链接:http://codeforces.com/contest/749/problem/C 题意:给定一个长度为n的D/R序列,代表每个人的派别,然后进行发表意见,顺序是从1到n.每个人到他的回 ...

  3. Codeforces Round #388 (Div. 2) - A

    题目链接:http://codeforces.com/contest/749/problem/A 题意:给定一个数n,求把n分解成尽量多的素数相加.输入素数个数和具体方案. 思路:因为要尽量多的素数, ...

  4. Codeforces Round #388 (Div. 2) A,B,C,D

    A. Bachgold Problem time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. Codeforces Round #388 (Div. 2) 749E(巧妙的概率dp思想)

    题目大意 给定一个1到n的排列,然后随机选取一个区间,让这个区间内的数随机改变顺序,问这样的一次操作后,该排列的逆序数的期望是多少 首先,一个随机的长度为len的排列的逆序数是(len)*(len-1 ...

  6. Codeforces Round #388 (Div. 2) D

    There are n people taking part in auction today. The rules of auction are classical. There were n bi ...

  7. Codeforces Round #388 (Div. 2) A+B+C!

    A. Bachgold Problem 任何一个数都可以由1和2组成,由于n是大于等于2的,也就是可以由2和3组成.要求最多的素数即素数越小越好,很明显2越多越好,如果n为奇数则再输出一个3即可. i ...

  8. Codeforces Round #388 (Div. 2) C. Voting

    题意:有n个人,每个人要么是属于D派要么就是R派的.从编号1开始按顺序,每个人都有一次机会可以剔除其他任何一个人(被剔除的人就不在序列中也就失去了剔除其他人的机会了):当轮完一遍后就再次从头从仅存的人 ...

  9. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

随机推荐

  1. 通过transform修改位置 大小 旋转 形变

    --通过transform修改位置(平移)- CGAffineTransformMakeTranslation(**X偏移量**, **Y偏移量**);- CGAffineTransformTrans ...

  2. #ThinkPHP_3.2.2模型# where查询条件汇总

    特别喜欢 ThinkPHP_3.2.3 框架的Model,结合官方手册及查看源代码,汇总出其大体用法: 核心转换方法: $this->parseWhere($where); $whereStr ...

  3. 提升PHP编程效率的20个要素

    用单引号代替双引号来包含字符串,这样做会更快一些.因为PHP会在双引号包围的字符串中搜寻变量,单引号则 不会,注意:只有echo能这么做,它是一种可以把多个字符串当作参数的“函数”(兄弟连PHP编程: ...

  4. Qt &QSS

    Today task:解决了qt中的一些控件无法使用qss的问题(如QProgressDialog 调节chunk的颜色,QMessageBox按钮的颜色问题)1,对于QMessageBox,可以单独 ...

  5. runtime第二部分成员变量和属性

    接上一篇 http://www.cnblogs.com/ddavidXu/p/5912306.html 转载来源http://www.jianshu.com/p/6b905584f536 http:/ ...

  6. Eclipse的快捷键

    Ctrl+Shift+L调出eclipse的所有快捷键 不定期更新2016#8#19 如何配置快捷键:windown-preferences-General-key 一些操作  Ctrl+D   删除 ...

  7. 1.44tft

    https://item.taobao.com/item.htm?spm=a230r.1.14.107.pBOVu5&id=16660981098&ns=1&abbucket= ...

  8. Maven pom.xml 元素配置说明(一)

    部分来源: Maven中 dependencies 节点和 dependencyManagement 节点的区别 dependencies与dependencyManagement的区别 maven ...

  9. latex公式编号

    1 \begin{flalign*} 2 % In this way (this arrange of &), the equation will in the center and alig ...

  10. Python 之旅

    Python2 之旅:   https://funhacks.net/explore-python/ <Python Cookbook>第三版   PYTHON3   http://pyt ...