zoj 1041 || poj 1106
来源:互联网 发布:大数据带来的变革更好 编辑:程序博客网 时间:2024/06/07 03:25
给你一个半圆的圆心和半径 求此半圆最多可以覆盖平面上几个点
#include<stdio.h>#include<math.h>#define dist(a,b) sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2))#define circulate(a,b) a.x*b.x+a.y*b.y#define N 151struct point{int x,y;} a[N],s;double r;int n,ans;void input(){int m,i=0;n=0;scanf("%d",&m);while (i<m){scanf("%d%d",&a[i].x,&a[i].y);if (dist(a[i],s)<=r) {a[n].x=a[i].x-s.x;a[n++].y=a[i].y-s.y;}i++;}}void deal(){int i,j,u1,u2,u3;for (i=0;i<n;i++){u1=0;u2=0;u3=0;s.x=a[i].y;s.y=-a[i].x;for (j=0;j<n;j++){if (circulate(s,a[j])>0) u1++;else if (circulate(s,a[j])==0) u2++;else u3++;}if (u1+u2>ans) ans=u1+u2;if (u2+u3>ans) ans=u2+u3;}}int main(void){while (scanf("%d%d%lf",&s.x,&s.y,&r)!=EOF){if (r<0) break;ans=0;input();deal();printf("%d\n",ans);}}
0 0
- zoj 1041 || poj 1106
- zoj 1041 || poj 1106 Transmitters
- ZOJ 1041(POJ 1106) Transmitters(…
- poj 3100 (zoj 2818)||ZOJ 2829 ||ZOJ 1938 (poj 2249)
- zoj 1354 poj 1222
- poj 1637 zoj 1992
- poj 3067 && zoj 3129
- ZOJ 1082(POJ 1125)
- zoj 1857 || poj 2607
- zoj poj 题目分类
- ZOJ POJ题目分类
- zoj 1361 | poj 1324
- POJ 2080/ZOJ 2420
- poj 1511,zoj 2008
- POJ 1129/ZOJ 1084
- zoj、poj 题目分类
- poj 2263&&zoj 1952
- poj 2253&zoj 1942
- 机器学习10k均值
- 机器学习11关联规则
- 文本挖掘1分词
- 文本挖掘2相似度计算
- memset函数使用详解
- zoj 1041 || poj 1106
- 接口
- TestNg--The next generation of testing--2
- Linux tcpdump
- 考试系统完型填空题优化
- 直接拿来用!最火的Android开源项目(一)
- 文件复制软件评测:FastCopy、TeraCopy、ExtremeCopy、Supercopier
- hdu 1232 畅通工程
- 使用MIT JWI(Java WordNet Interface)查询WordNet反义词