CodeForces 617D Polyline
无脑暴力判断。
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<list>
#include<algorithm>
using namespace std; struct point
{
long long x;
long long y;
}p1,p2,p3; int main()
{
scanf("%lld%lld",&p1.x,&p1.y);
scanf("%lld%lld",&p2.x,&p2.y);
scanf("%lld%lld",&p3.x,&p3.y); if(p1.x==p2.x&&p2.x==p3.x) printf("1\n");
else if(p1.y==p2.y&&p2.y==p3.y) printf("1\n");
else if(p1.y==p2.y&&(p3.x>=max(p1.x,p2.x)||p3.x<=min(p1.x,p2.x))) printf("2\n");
else if(p3.y==p2.y&&(p1.x>=max(p3.x,p2.x)||p1.x<=min(p3.x,p2.x))) printf("2\n");
else if(p1.y==p3.y&&(p2.x>=max(p1.x,p3.x)||p2.x<=min(p1.x,p3.x))) printf("2\n");
else if(p1.x==p2.x&&(p3.y>=max(p1.y,p2.y)||p3.y<=min(p1.y,p2.y))) printf("2\n");
else if(p3.x==p2.x&&(p1.y>=max(p3.y,p2.y)||p1.y<=min(p3.y,p2.y))) printf("2\n");
else if(p1.x==p3.x&&(p2.y>=max(p1.y,p3.y)||p2.y<=min(p1.y,p3.y))) printf("2\n");
else printf("3\n");
return ;
}
CodeForces 617D Polyline的更多相关文章
- Codeforces Round #340 (Div. 2) D. Polyline 水题
D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three p ...
- codeforces B. 4-point polyline 解题报告
题目链接:http://codeforces.com/problemset/problem/452/B 题目意思:给出一个长为n,宽为 m 的矩形,要从这里面(包括边上)找出4个不同的点,使得以某一个 ...
- Analyzing Polyline CodeForces - 195D
Analyzing Polyline CodeForces - 195D 题意:有n个函数,第i个函数yi(x)=max(ki*x+bi,0).定义函数s(x)=y1(x)+y2(x)+...+yn( ...
- 【26.09%】【codeforces 579C】A Problem about Polyline
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] C C Problem about Polyline 数学
C. A Problem about Polyline ...
- codeforces Round #320 (Div. 2) C. A Problem about Polyline(数学) D. "Or" Game(暴力,数学)
解题思路:就是求数 n 对应的二进制数中有多少个 1 #include <iostream> #include<cstdio> using namespace std; int ...
- codeforces 578a//A Problem about Polyline// Codeforces Round #320 (Div. 1)
题意:一个等腰直角三角形一样的周期函数(只有x+轴),经过给定的点(a,b),并且半周期为X,使X尽量大,问X最大为多少? 如果a=b,结果就为b 如果a<b无解. 否则,b/(2*k*x-a) ...
- Codeforces Round #320 (Div. 1) [Bayan Thanks-Round] A A Problem about Polyline(数学)
题目中给出的函数具有周期性,总可以移动到第一个周期内,当然,a<b则无解. 假设移动后在上升的那段,则有a-2*x*n=b,注意限制条件x≥b,n是整数,则n≤(a-b)/(2*b).满足条件的 ...
- Analyzing Polyline -- Codeforces Round #123 (Div. 2)
题意:https://codeforc.es/problemset/problem/195/D 求折线段数. 思路: 对pos进行sort,对不同区间段加k,两个dp处理不同k>0 or k&l ...
随机推荐
- 自定义switch开关
自定义一个switch开关 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...
- Properties集合
Map |--Hashtable |--Properties Properties集合特点: 1.该集合中的键和值都是字符串类型 2.集合中的数据可以保存在IO流中或者从IO流中获取数据. 通常该集合 ...
- jquery 简单的栏目切换
<style> ul{ list-style:none; padding:0px; margin:0px;} #nav_box{ width:502px; height:402px; ov ...
- 深入解析FileInputStream和FileOutputStream
http://swiftlet.net/archives/1363 FileInputStream和FileOutputStream类属于字节类,可以操作任意类型的文件.在数据流的处理过程中,有两种情 ...
- 代码创建xml文档并写入指定节点
//首先创建 XmlDocument xml文档 XmlDocument xml = new XmlDocument(); //创建根节点 config XmlElement config = xml ...
- css 7.30
1.外提到内联元素,我们会想到有个display的属性是display:inline;这个属性能够修复著名的IE双倍浮动边界(float时margin)问题 2.一般来说,可以为所有块级元素应用 te ...
- java 对象流
TV.java import java.io.*; public class TV implements Serializable{ String name; int price; public vo ...
- byte 读写文件
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import ja ...
- jq之简单的表单验证
<body> <form method="post" action=""> <div class="int"& ...
- Redis学习笔记(二)-key相关命令【转载】
转自 Redis学习笔记(二)-key相关命令 - 点解 - 博客园http://www.cnblogs.com/leny/p/5638764.html Redis支持的各种数据类型包括string, ...