uva 11437 - Triangle Fun
计算几何;
直线交点;
#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的更多相关文章
- UVa 11437:Triangle Fun(计算几何综合应用,求直线交点,向量运算,求三角形面积)
Problem ATriangle Fun Input: Standard Input Output: Standard Output In the picture below you can see ...
- UVA 11437 - Triangle Fun 向量几何
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- 简单几何(求交点) UVA 11437 Triangle Fun
题目传送门 题意:三角形三等分点连线组成的三角形面积 分析:入门题,先求三等分点,再求交点,最后求面积.还可以用梅涅劳斯定理来做 /********************************** ...
- uva 11401 Triangle Counting
// uva 11401 Triangle Counting // // 题目大意: // // 求n范围内,任意选三个不同的数,能组成三角形的个数 // // 解题方法: // // 我们设三角巷的 ...
- UVa 11437 (梅涅劳斯定理) Triangle Fun
题意: 给出三角形ABC顶点的坐标,DEF分别是三边的三等分点.求交点所形成的三角形PQR的面积. 分析: 根据梅涅劳斯定理,我们得到: ,解得 另外还有:,解得 所以AR : RP : PD = 3 ...
- UVa 488 - Triangle Wave
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...
- 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. ...
- UVA 488 - Triangle Wave 水~
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- 【递推】【组合计数】UVA - 11401 - Triangle Counting
http://blog.csdn.net/highacm/article/details/8629173 题目大意:计算从1,2,3,...,n中选出3个不同的整数,使得以它们为边长可以构成三角形的个 ...
随机推荐
- Mysql 半同步复制配置
以下是配置和监控半同步复制: 1. 半同步复制功能以plugin的方式接入MySQL,需要在主库与从库两端同时开启半同步的支持,具体配置如下: On the master mysql> INST ...
- JUnit4注解基本介绍
@After If you allocate external resources in a Before method you need to release them after the test ...
- JQuery事件的绑定
关于jQuery事件绑定html: <a href="#" onclick="addBtn()">addBtn</a> <div ...
- Magento 使用心得
Modules->模块 Controller->控制器 Model->模型 Magento是这个星球上最强大的购物车网店平台.当然,你应该已经对此毫无疑问了.不过,你可能还不知道,M ...
- jquery的事件绑定
暂时有 bind(),live(),delegate(),on() 这四个事件监听函数 对应的4个事件解除函数分别是: unbind(),die(),undelegate(),off() bind:向 ...
- LiangNa Resum
LiangNa AnShan Street, YangPu, NY @.com OBJECTIVE: Seeking a position to contribute my skills and ed ...
- swift-08-使用键值对儿统计字符在字符串中出现的次数
// // main.swift // 12- // // Created by wanghy on 15/8/9. // Copyright (c) 2015年 wanghy. All ri ...
- 关于arcgis 9.3破解问题详解
对于初学GIS的同学,安装软件可能会遇到各种各样的问题,对于photoshop,autocad,sketchup,3dmax等软件我们的我们无非是输入特定序列号或者用工具随机生成特定序列号就可以破解, ...
- Javascript中数组方法汇总
Array.prototype中定义了很多操作数组的方法,下面介绍ECMAScript3中的一些方法: 1.Array.join()方法 该方法将数组中的元素都转化为字符串并按照指定符号连接到一起,返 ...
- HDU 1619 Unidirectional TSP(单向TSP + 路径打印)
Unidirectional TSP Problem Description Problems that require minimum paths through some domain appea ...