poj 2318
来源:互联网 发布:扫描仪软件 编辑:程序博客网 时间:2024/05/19 17:27
#include<stdio.h>#include<string.h>struct node{double x,y;}up[5050],down[5050],t[5050];double mult(struct node a,struct node b,struct node c){return (a.x-c.x)*(b.y-c.y)-(a.y-c.y)*(b.x-c.x);}int main(){int n,m,i,j;double x1,x2,y2,y1,a,b,t1,t2;int ans[5050];while(scanf("%d",&n),n!=0){memset(ans,0,sizeof(ans));scanf("%d%lf%lf%lf%lf",&m,&x1,&y1,&x2,&y2);up[0].x=x1;up[0].y=y1;down[0].x=x1;down[0].y=y2;up[n+1].x=x2;up[n+1].y=y1;down[n+1].x=x2;down[n+1].y=y2;for(i=1;i<=n;i++){scanf("%lf%lf",&a,&b);up[i].x=a;up[i].y=y1;down[i].x=b;down[i].y=y2;}for(i=0;i<m;i++) scanf("%lf%lf",&t[i].x,&t[i].y);for(i=0;i<m;i++){for(j=1;j<=n+1;j++){t1=mult(up[j-1],down[j-1],t[i]);t2=mult(up[j],down[j],t[i]);if(t1*t2<=0){ans[j-1]++;break;}}}for(i=0;i<=n;i++)printf("%d: %d\n",i,ans[i]);printf("\n");}return 0;}
0 0
- poj 2318 poj 2398
- poj 2318
- POJ 2318
- poj 2318
- POJ 2318
- poj 2318
- poj.2318
- poj 2318
- poj 2318
- POJ-2318
- poj 2318
- POJ 2318
- POJ 2318 几何 POJ 2398
- POJ 2318 TOYS && POJ 2398 Toy Storage
- 【计算几何】POJ 2318 & POJ 2398
- POJ 2318 TOYS || POJ 2398 Toy Storage
- POJ 2318 TOYS
- poj 2318 TOYS
- 再见c3p0
- hbase-0.20.6数据写入服务端代码性能瓶颈分析
- 【转】“INT 21H”指令说明及使用方法
- jetty服务器性能调整过程分析
- rfc2222
- poj 2318
- memcached源代码分析
- spring MVC配置详解
- va_list和vsnprintf
- 计算机缓存漫谈
- NanShan 开始了解安卓系统 前行路上的14项技能
- zookeeper介绍
- 又3年
- java7初窥