hdu1086 You can Solve a Geometry Problem too
来源:互联网 发布:淘宝靠谱二手手机店铺 编辑:程序博客网 时间:2024/06/06 19:34
#include <stdio.h>//(abXac)(abXad)<0 && (cdXca)(cdXcb)<0struct segment{double x1,y1,x2,y2;}seg[102];int Judge(int i,int j){double a,b,c,d,x,y,a1,b1;a=seg[i].x1-seg[j].x1;b=seg[i].y1-seg[j].y1;a1=seg[i].x2-seg[j].x1;b1=seg[i].y2-seg[j].y1;c=seg[j].x2-seg[j].x1;d=seg[j].y2-seg[j].y1;x=a*d-b*c;y=a1*d-b1*c;if(x*y<=0)return 1;elsereturn 0;}int main(){int n,i,j,count;while(scanf("%d",&n)&&n){count=0;for (i=1;i<=n;i++){scanf("%lf %lf %lf %lf",&seg[i].x1,&seg[i].y1,&seg[i].x2,&seg[i].y2);}for (i=1;i<n;i++){for(j=i+1;j<=n;j++)if(Judge(i,j)&&Judge(j,i))count++;}printf("%d\n",count);}return 0;}
- hdu1086 You can Solve a Geometry Problem too
- hdu1086 You can Solve a Geometry Problem too
- HDU1086 You can Solve a Geometry Problem too
- HDU1086 You can Solve a Geometry Problem too
- HDU1086 You can Solve a Geometry Problem too(数学几何)
- hdu1086 You can Solve a Geometry Problem too
- HDU1086:You can Solve a Geometry Problem too(线段相交模板)
- ACM-计算几何之You can Solve a Geometry Problem too——hdu1086
- hdu1086+You can Solve a Geometry Problem too(计算几何,计算线段交点个数)
- You can Solve a Geometry Problem too (hdu1086)几何,判断两线段相交
- hdu1086 You can Solve a Geometry Problem too (判断两线段是否相交)
- hdu1086 You can Solve a Geometry Problem too【排斥实验+跨立实验】
- You can Solve a Geometry Problem too
- You can Solve a Geometry Problem too
- You can Solve a Geometry Problem too
- You can Solve a Geometry Problem too
- hdu1086 You can Solve a Geometry Problem too 计算几何求线段交点个数,快速排斥实验+跨立实验
- hdu 1086 You can Solve a Geometry Problem too
- Extjs4前端开发代码规范参考
- 关于TI 6000系列DSP优化经验
- 解决打开应用评分报错问题
- 函数指针数组
- 解决 CoreText去除换行符的问题
- hdu1086 You can Solve a Geometry Problem too
- 指针数组和数组指针
- 什么是大牛,我彻底服了,大牛讲解信号与系统
- 二维数组和指针
- dll(动态链接库)之间以及和exe之间的函数、类或全局变量互传
- VS2005下开发PPC2003和WM50编译器一些设置
- 帧动画
- Java程序员的堕落
- 深入理解指针