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 ...
随机推荐
- 小程序button 去边框
/*使用 button::after{ border: none; } 来去除边框*/.free-btn-bordernone{ background: none !important; color: ...
- C do whlie 数数位
#include <stdio.h> int main(int argc, char **argv) { //定义两个变量 x 跟 n,n的初始化为0: int x; int n ...
- 对Java对象的认识与理解
今天是我学习编程以来第一次写博客,记下平日学习所得,本来这几日都在学习web框架 但觉得梳理一下之前所学很有必要.毕竟之前学习Java感觉很粗略只是以考试为目的.所以就以<Thinking in ...
- 团队Beta阶段事后分析
团队Beta阶段事后分析 设想和目标 我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有清晰的描述? 我们的软件要解决用户的休闲娱乐问题,为用户提供好玩的模拟经营类的游戏,游戏主题 ...
- 20145214实验一 Java开发环境的熟悉
20145214实验一 Java开发环境的熟悉 使用JDK编译.运行简单的java程序 命令行下程序开发 在命令行下建立20145214实验目录,进入该目录后创建exp1目录. 把代码保存到exp1目 ...
- 【IdentityServer4文档】- 支持和咨询选项
支持和咨询选项 我们为 IdentityServer 提供多个免费和商业支持及咨询选项. 免费支持 免费支持是基于社区的,而且使用的是公共论坛 StackOverflow 有越来越多的使用 Ident ...
- LintCode-212.空格替换
空格替换 设计一种方法,将一个字符串中的所有空格替换成 %20 .你可以假设该字符串有足够的空间来加入新的字符,且你得到的是"真实的"字符长度. 你的程序还需要返回被替换后的字符串 ...
- Jenkins系列-Jenkins通过Publish over SSH插件实现远程部署
配置ssh免秘钥登录 安装Publish over SSH插件 插件使用官网:https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plug ...
- Delphi 自定义窗体(最大化、最小化、关闭、窗体的移动)
Uses ShellAPI; 1.//最小化procedure TForm1.btn1Click(Sender: TObject);var I, J, X, Y: Word;begin //第一种 ...
- 当提交的表单类型为multipart/form-data时 后台的dopost则不能使用 setCharset来进行解码了 需要单独对字段使用 原始的new String(req.name("ISO-8859-1"),"utf-8")形式解码了
当提交的表单类型为multipart/form-data时 后台的dopost则不能使用 setCharset来进行解码了 需要单独对字段使用 原始的new String(req.name(" ...