题目链接: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. Python绘图

    1.二维绘图 a. 一维数据集 用 Numpy ndarray 作为数据传入 ply 1. import numpy as np import matplotlib as mpl import mat ...

  2. 悲剧啊!Mysql的上古BUG!!!

    导读 这是MySQL8.0修复的上古bug之一,在2003年由Percona的CEO(当时应该还没Percona吧)提出的bug#199,光看这bug号就扑面而来一股上古时代的沧桑气息. 问题的本质在 ...

  3. Java的垃圾回收和内存分配策略

    本文是<深入理解Java虚拟机 JVM高级特性与最佳实践>的读书笔记 在介绍Java的垃圾回收方法之前,我们先来了解一下Java虚拟机在执行Java程序的过程中把它管理的内存划分为若干个不 ...

  4. 学习 opencv---(7) 线性邻域滤波专场:方框滤波,均值滤波,高斯滤波

    本篇文章中,我们一起仔细探讨了OpenCV图像处理技术中比较热门的图像滤波操作.图像滤波系列文章浅墨准备花两次更新的时间来讲,此为上篇,为大家剖析了"方框滤波","均值滤 ...

  5. PHP 数据库连接工具类(MySQLI函数包装)

    ====================mysql===================== <?php class mysql { private $mysqli; private $resu ...

  6. scrapy加载cookies登陆

    import scrapy from xxxx.items import XXXXItem from scrapy.http.request import Request class ZndsSpid ...

  7. MyBatis:统计数量

    dao: /** * 统计商家的案例数量 * * @param shopId * @return */ long countByShopId(Long shopId); @Override publi ...

  8. The difference between QA, QC, and Test Engineering

    Tuesday, March 06, 2007 Posted by Allen Hutchison, Engineering Manager and Jay Han, Software Enginee ...

  9. root切换

    1.su -i root.password 2.su passwd root pass pass su pass 3.su -val 一般用户名 4.

  10. printf和scanf

    一 printf和scanf(printf和scanf是c语言中的输入输出库函数) printf(”格式控制“,输出列表) <1>格式控制 其中包含 格式声明(%+相应格式对应字母).转义 ...