计算几何;

直线交点;

 #include<cstdio>
using namespace std; struct node
{
double x,y;
node(double x=,double y=):x(x),y(y){ }
}a,b,c,d,e,f,p,q,r;
node operator-(node u,node v){return node(u.x-v.x,u.y-v.y);}
node operator+(node u,node v){return node(u.x+v.x,u.y+v.y);}
node operator*(node u,double v){return node(u.x*v,u.y*v);}
node operator/(node u,double v){return node(u.x/v,u.y/v);} double cross(node u,node v)
{
return u.x*v.y-u.y*v.x;
} node get(node p,node v,node q,node w)
{
node u=p-q;
double t=cross(w,u)/cross(v,w);
return p+v*t;
} int main()
{
int n;
scanf("%d",&n);
while(n--)
{
scanf("%lf%lf",&a.x,&a.y);
scanf("%lf%lf",&b.x,&b.y);
scanf("%lf%lf",&c.x,&c.y);
d=b+(c-b)/;
e=c+(a-c)/;
f=a+(b-a)/;
p=get(b,e-b,a,d-a);
q=get(c,f-c,b,e-b);
r=get(c,f-c,d,a-d);
printf("%.0lf\n",cross(q-p,r-p)/);
}
return ;
}

uva 11437 - Triangle Fun的更多相关文章

  1. UVa 11437:Triangle Fun(计算几何综合应用,求直线交点,向量运算,求三角形面积)

    Problem ATriangle Fun Input: Standard Input Output: Standard Output In the picture below you can see ...

  2. UVA 11437 - Triangle Fun 向量几何

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  3. 简单几何(求交点) UVA 11437 Triangle Fun

    题目传送门 题意:三角形三等分点连线组成的三角形面积 分析:入门题,先求三等分点,再求交点,最后求面积.还可以用梅涅劳斯定理来做 /********************************** ...

  4. uva 11401 Triangle Counting

    // uva 11401 Triangle Counting // // 题目大意: // // 求n范围内,任意选三个不同的数,能组成三角形的个数 // // 解题方法: // // 我们设三角巷的 ...

  5. UVa 11437 (梅涅劳斯定理) Triangle Fun

    题意: 给出三角形ABC顶点的坐标,DEF分别是三边的三等分点.求交点所形成的三角形PQR的面积. 分析: 根据梅涅劳斯定理,我们得到: ,解得 另外还有:,解得 所以AR : RP : PD = 3 ...

  6. UVa 488 - Triangle Wave

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...

  7. UVA 11401 - Triangle CountingTriangle Counting 数学

    You are given n rods of length 1,2, . . . , n. You have to pick any 3 of them and build a triangle. ...

  8. UVA 488 - Triangle Wave 水~

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  9. 【递推】【组合计数】UVA - 11401 - Triangle Counting

    http://blog.csdn.net/highacm/article/details/8629173 题目大意:计算从1,2,3,...,n中选出3个不同的整数,使得以它们为边长可以构成三角形的个 ...

随机推荐

  1. Android开发之自定义圆角矩形图片ImageView的实现

    android中的ImageView只能显示矩形的图片,这样一来不能满足我们其他的需求,比如要显示圆角矩形的图片,这个时候,我们就需要自定义ImageView了,其原理就是首先获取到图片的Bitmap ...

  2. Android_Component_example

    xml布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:t ...

  3. 什么是aop?

    这个命题其实是讲了的,但是之前没有做,发现一些面试会问到,结合自己之前的学习经历.简单把这个问题描述一下. aop是跟oop相对应的一个概念.分别是aspect oriented programmin ...

  4. Python开发笔记之正则表达式的使用

    查找正则表达式 import re re_txt = re.compile(r'(\d)*.txt') m = re_txt.search(src) if not m == None: m.group ...

  5. 安装完Kali linux 之后 需要配置的一些 常用软件 记录

    apt 阿里云开源镜像站 deb http://mirrors.aliyun.com/kali sana main non-free contribdeb http://mirrors.aliyun. ...

  6. c#的方法重写和的java方法重写有什么区别

    java code: package example; class m1 { public int getInt() { return 0; } } class m2 extends m1 { pub ...

  7. Python 基础【第三篇】输入和输出

    这里我们创建一个python(pytest)脚本用于学习测试(以后都为这个文件,不多做解释喽),这个文件必须要有执行权限的哈 1.创建pytest并赋予执行权限 [root@fengyuba_serv ...

  8. java 正则表达式匹配字符串

    private static List<String> getImage(String str){ List<String> tmp=new ArrayList<Stri ...

  9. MVC Filter自定义异常(拦截)

    // ----------------------------------------------------------------------- // <copyright file=&qu ...

  10. AWK详细用法

    awk非常的优秀,运行效率高,而且代码简单,对格式化的文本处理能力超强.基本上grep和sed能干的活awk全部都能干,而且干得更好. 先来一个很爽的例子:文件a,统计文件a的第一列中是浮点数的行的浮 ...