Codeforces Round #340 (Div. 2) D
1 second
256 megabytes
standard input
standard output
There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of only segments parallel to the coordinate axes. You are to find the minimum number of segments this polyline may consist of.
Each of the three lines of the input contains two integers. The i-th line contains integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th point. It is guaranteed that all points are distinct.
Print a single number — the minimum possible number of segments of the polyline.
1 -1
1 1
1 2
1
-1 -1
-1 3
4 3
2
1 1
2 3
3 2
3
The variant of the polyline in the first sample:
The variant of the polyline in the second sample:
The variant of the polyline in the third sample:
题意 三个点 划平行于坐标轴的线 没有自生相交
问有多少个线段组成
特别样例
0 0
0 1
1 2
这把 hack 了别人几发 代码写搓了 现在补
#include<iostream>
#include<cstdio>
using namespace std;
__int64 x1,y1,x2,y2,x3,y3;
int main()
{
scanf("%I64d %I64d %I64d %I64d %I64d %I64d",&x1,&y1,&x2,&y2,&x3,&y3);
if((x1==x2&&x2==x3)||(y1==y2&&y2==y3))
printf("1\n");
else
{
if((x2==x3&&y3>y2&&(y1>=y3||y1<=y2))||(x2==x3&&y2>y3&&(y1>=y2||y1<=y3))|| (x1==x2&&y1>y2&&(y3>=y1||y3<=y2))||(x1==x2&&y1<y2&&(y3>=y2||y3<=y1))||(x1==x3&&y1>y3&&(y2>=y1||y2<=y3))||(x1==x3&&y1<y3&&(y2>=y3||y2<=y1))|| (y1==y2&&x1<x2&&(x3<=x1||x3>=x2))||(y1==y2&&x1>x2&&(x3>=x1||x3<=x2))||(y2==y3&&x3>x2&&(x1>=x3||x1<=x2))||(y2==y3&&x2>x3&&(x1>=x2||x1<=x3))|| (y1==y3&&x1<x3&&(x2<=x1||x2>=x3))||(y1==y3&&x1>x3&&(x2>=x1||x2<=x3)))
printf("2\n");
else
printf("3\n");
}
return 0;
}
Codeforces Round #340 (Div. 2) D的更多相关文章
- [Codeforces Round #340 (Div. 2)]
[Codeforces Round #340 (Div. 2)] vp了一场cf..(打不了深夜的场啊!!) A.Elephant 水题,直接贪心,能用5步走5步. B.Chocolate 乘法原理计 ...
- Codeforces Round #340 (Div. 2) E. XOR and Favorite Number 莫队算法
E. XOR and Favorite Number 题目连接: http://www.codeforces.com/contest/617/problem/E Descriptionww.co Bo ...
- Codeforces Round #340 (Div. 2) C. Watering Flowers 暴力
C. Watering Flowers 题目连接: http://www.codeforces.com/contest/617/problem/C Descriptionww.co A flowerb ...
- Codeforces Round #340 (Div. 2) B. Chocolate 水题
B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...
- Codeforces Round #340 (Div. 2) A. Elephant 水题
A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decid ...
- Codeforces Round #340 (Div. 2) D. Polyline 水题
D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three p ...
- 「日常训练」Watering Flowers(Codeforces Round #340 Div.2 C)
题意与分析 (CodeForces 617C) 题意是这样的:一个花圃中有若干花和两个喷泉,你可以调节水的压力使得两个喷泉各自分别以\(r_1\)和\(r_2\)为最远距离向外喷水.你需要调整\(r_ ...
- Codeforces Round #340 (Div. 2) E. XOR and Favorite Number 【莫队算法 + 异或和前缀和的巧妙】
任意门:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 ...
- Codeforces Round #340 (Div. 2) E. XOR and Favorite Number —— 莫队算法
题目链接:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 ...
- Codeforces Round #340 (Div. 2) E. XOR and Favorite Number (莫队)
题目链接:http://codeforces.com/contest/617/problem/E 题目大意:有n个数和m次查询,每次查询区间[l, r]问满足ai ^ ai+1 ^ ... ^ aj ...
随机推荐
- Python常用函数--文档字符串DocStrings
Python 有一个甚是优美的功能称作python文档字符串(Documentation Strings),在称呼它时通常会使用另一个短一些的名字docstrings.DocStrings 是一款你应 ...
- 解决ssh_exchange_identification:read connection reset by peer 原因
服务器改了密码,试过密码多次后出现: ssh_exchange_identification: read: Connection reset by peer 可以通过ssh -v查看连接时详情 Ope ...
- 在几份docx文档中里查找某个值
import docx, os def readDocx(fileName): doc = docx.Document(fileName) content = '\n'.join([para.text ...
- [Clr via C#读书笔记]Cp3共享程序集和强命名程
Cp3共享程序集和强命名程序集 私有方式部署+全局方式部署:弱命名程序集+强命名程序集 强命名程序集使用发布者的公钥私钥进行签名,唯一标识发布者. 共享dll被全部复制到System32中 强命名程序 ...
- docker 命令笔记
docker images 查看镜像 docker search 查找镜像 docker pull 拉取镜像 docker push 推送镜像 docker ps 查看正在运行的容器 docker p ...
- Ubuntu 常用软件推荐(QQ、微信、MATLAB等)及安装过程
1. Wine QQ QQ 移植到 Linux 一直是一个比较头疼的问题,但我们日常交流.传输文件又离不开这个软件.在网上一番搜寻尝试后,发现最好的替代方案就是 Wine QQ,版本也还比较新,缺点是 ...
- 基于MTCNN多任务级联卷积神经网络进行的人脸识别 世纪晟人脸检测
神经网络和深度学习目前为处理图像识别的许多问题提供了最佳解决方案,而基于MTCNN(多任务级联卷积神经网络)的人脸检测算法也解决了传统算法对环境要求高.人脸要求高.检测耗时高的弊端. 基于MTCNN多 ...
- Python3 标准库:sys
import sys print(sys.argv[0]) print(sys.argv[1]) print(len(sys.argv)) print(str(sys.argv)) print(sys ...
- 2.azkaban3.0安装
安装规划安装azkban1.安装配置数据库2.下载安装web server3.安装mulit executor4.安装azkaban插件AZKABAN参数安装出现的问题 安装规划 IP 角色 端口 1 ...
- 将footer固定在页面最下方
方法一: HTML结构: <div id="id_wrapper"> <div id="id_header"> Header Block ...