1106 Transmitters
来源:互联网 发布:打色子软件 编辑:程序博客网 时间:2024/05/17 23:27
向量的叉乘大于0即是在直线的同一边。
#include<iostream>#include<cmath>#include<algorithm>#include<cstdio>using namespace std;struct point{double x;double y;}p[1000],center;int tmax(int a, int b){return a>b?a:b;}double dis(point a,point b){//d^2return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}double multi(point a,point b,point o){//叉乘 a*d-b*creturn(a.x-o.x)*(b.y-o.y)-(a.y-o.y)*(b.x-o.x);}int main(){freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);int n;double r;while(cin>>center.x>>center.y>>r && r>=0){int result = 0;cin>>n;for(int i=0;i<n;i++){cin>>p[i].x>>p[i].y;}for(int k=0;k<n;k++){int count1 = 0;int count2 = 0;if(dis(p[k],center)<=r*r){for(int j=0;j<n;j++){if(dis(p[j],center)<=r*r){if(multi(p[k],p[j],center)>0)count1++;elsecount2++;}}}result = tmax(result,tmax(count1,count2));}cout<<result<<endl;}return 0;}
0 0
- 1106 Transmitters
- POJ 1106 Transmitters
- poj 1106 Transmitters
- POJ 1106 Transmitters
- POJ 1106 Transmitters
- POJ 1106 Transmitters
- POJ 1106 Transmitters
- POJ 1106 Transmitters
- POJ 1106 Transmitters
- POJ 1106 Transmitters
- Transmitters
- zoj 1041 || poj 1106 Transmitters
- POJ-1106 Transmitters解题报告
- POJ 1106 Transmitters 计算几何
- POJ 1106 Transmitters(叉积)
- poj 1106 Transmitters 计算几何
- POJ 1106 Transmitters(离散化)
- poj 1106 Transmitters(极角排序)
- DIV+CSS clear both清除产生浮动
- ListView(2)SimpleAdapter与SimpleCursorAdapter详解
- C++成员函数的存储方式
- 1105 S-Trees
- 第16周阅读程序1(1)
- 1106 Transmitters
- java异常总结
- Libgdx之Table 表格排版
- 做程序猿的wife应该注意的一些事情
- 二次封装快捷实现Echarts可视化图表
- 安装部署OFBIZ
- MQTT基础——Part 1. 认识MQTT
- POJ 1159 Palindrome
- spark集群搭建