D. Polyline
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

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.

Input

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.

Output

Print a single number — the minimum possible number of segments of the polyline.

Sample test(s)
Input
1 -1
1 1
1 2
Output
1
Input
-1 -1
-1 3
4 3
Output
2
Input
1 1
2 3
3 2
Output
3
Note

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的更多相关文章

  1. [Codeforces Round #340 (Div. 2)]

    [Codeforces Round #340 (Div. 2)] vp了一场cf..(打不了深夜的场啊!!) A.Elephant 水题,直接贪心,能用5步走5步. B.Chocolate 乘法原理计 ...

  2. 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 ...

  3. Codeforces Round #340 (Div. 2) C. Watering Flowers 暴力

    C. Watering Flowers 题目连接: http://www.codeforces.com/contest/617/problem/C Descriptionww.co A flowerb ...

  4. Codeforces Round #340 (Div. 2) B. Chocolate 水题

    B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...

  5. Codeforces Round #340 (Div. 2) A. Elephant 水题

    A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decid ...

  6. Codeforces Round #340 (Div. 2) D. Polyline 水题

    D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three p ...

  7. 「日常训练」Watering Flowers(Codeforces Round #340 Div.2 C)

    题意与分析 (CodeForces 617C) 题意是这样的:一个花圃中有若干花和两个喷泉,你可以调节水的压力使得两个喷泉各自分别以\(r_1\)和\(r_2\)为最远距离向外喷水.你需要调整\(r_ ...

  8. 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 ...

  9. 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 ...

  10. 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 ...

随机推荐

  1. 微服务框架Dubbo与Springcloud的区别

    微服务框架Dubbo与Springcloud的区别 微服务主要的优势如下: 1.降低复杂度 将原来偶合在一起的复杂业务拆分为单个服务,规避了原本复杂度无止境的积累.每一个微服务专注于单一功能,并通过定 ...

  2. lintcode373 奇偶分割数组

    奇偶分割数组 分割一个整数数组,使得奇数在前偶数在后. 您在真实的面试中是否遇到过这个题? Yes 样例 给定 [1, 2, 3, 4],返回 [1, 3, 2, 4]. 我的方法:设定两个数组,分别 ...

  3. 211. String Permutation【LintCode by java】

    Description Given two strings, write a method to decide if one is a permutation of the other. Exampl ...

  4. Memcache的客户端连接系列(一) Java

    声明:本文并非原创,转自华为云帮助中心的分布式缓存服务(Memcached)的用户指南. 关键词: Memcached  客户端 Java Java连接池 Java客户端示例 用户的弹性云服务器已安装 ...

  5. http://www.yiibai.com/javalang/string_endswith.html

    http://www.yiibai.com/javalang/string_endswith.html

  6. P4编程环境搭建

    本文参照了sdnlab上相关文章的搭建推荐. 使用的系统环境为ubuntu 18.04 组件介绍 主要安装五个组件: BMv2:是一款支持P4编程的软件交换机 p4c:是一款P4的编译器 PI:是P4 ...

  7. ACM 第一天

    标签库元素: 队列<queue> FIFO 栈 <stack>  FICO 集合 set 不定长数组  vector 映射 map Maximum Multiple Time ...

  8. The New Day

    于博毅 160809107 爱好电脑研究 选大学专业的时候,把计算机类放在了第一专业,当时从小就很喜欢计算机,以前有接触过编程但仅限于看书,并没有动手实践过,选课的时候看了一下专业课程,都是我想学的 ...

  9. AMH面板命令操作大全

    LNMP面板 - AMH 命令使用nginx篇 » SSH Nginx1) 有步骤提示操作: ssh执行命令: amh nginx然后选择对应选项进行操作. 2) 或直接操作: 启动Nginx: am ...

  10. VS05错误:部署WEB文件失败

    直接生成一个空项目就不存在这个问题了.