UVa 11437 (梅涅劳斯定理) Triangle Fun
题意:

给出三角形ABC顶点的坐标,DEF分别是三边的三等分点。求交点所形成的三角形PQR的面积。
分析:
根据梅涅劳斯定理,我们得到:
,解得
另外还有:,解得
所以AR : RP : PD = 3 : 3 : 1
同理,BE和CF也被分成这样比例的三段。
△ADC = (2/3)△ABC
△CDR = (4/7)△ADC
△CPR = (3/4)△CDR
△PQR = (1/2)△CPR
所以:△PQR = (1/7)△ABC
#include <cstdio>
#include <cmath>
struct Point
{
double x, y;
Point(double x=, double y=):x(x), y(y) {}
};
typedef Point Vector;
Point operator - (const Point& a, const Point& b)
{
return Point(a.x-b.x, a.y-b.y);
}
double Cross(Vector a, Vector b)
{
return a.x*b.y - a.y*b.x;
}
double area(const Point& a, const Point& b, const Point& c)
{
return fabs(Cross(b-a, c-a)/);
} int main()
{
//freopen("11437in.txt", "r", stdin);
int T;
scanf("%d", &T);
while(T--)
{
Point a, b, c;
scanf("%lf%lf%lf%lf%lf%lf", &a.x, &a.y, &b.x, &b.y, &c.x, &c.y);
double ans = area(a, b, c) / ;
printf("%d\n", (int)floor(ans+0.5000));
}
return ;
}
代码君
UVa 11437 (梅涅劳斯定理) Triangle Fun的更多相关文章
- 简单几何(求交点) 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
计算几何: 直线交点: #include<cstdio> using namespace std; struct node { double x,y; node(,):x(x),y(y){ ...
- UVa 10720 - Graph Construction(Havel-Hakimi定理)
题目链接: 传送门 Graph Construction Time Limit: 3000MS Memory Limit: 65536K Description Graph is a coll ...
- Make a Crystal UVA - 11014 (容斥定理)
题意:给定一个NxNxN的正方体,求出最多能选几个整数点,使得任意两点PQ不会使PQO共线. 思路:利用容斥原理,设f(k)为点(x, y, z)三点都为k的倍数的点的个数(要扣掉一个原点O),那么所 ...
- UVA 12165 Triangle Hazard
https://cn.vjudge.net/problem/UVA-12165 题目 给出D.E.F分BC,CA,AB的比$m_1:m_2$,$m_3:m_4$,$m_5:m_6$和PQR三点的坐标, ...
- ACM计算几何题目推荐
//第一期 计算几何题的特点与做题要领: 1.大部分不会很难,少部分题目思路很巧妙 2.做计算几何题目,模板很重要,模板必须高度可靠. 3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面 ...
- ACM学习历程—HDU5476 Explore Track of Point(平面几何)(2015上海网赛09题)
Problem Description In Geometry, the problem of track is very interesting. Because in some cases, th ...
随机推荐
- stm32GPIO8种模式
stm32GPIO工作模式及用途 1.浮空输入GPIO_IN_FLOATING ——浮空输入,可以做KEY识别,RX1 2.带上拉输入GPIO_IPU——IO内部上拉电阻输入 ...
- Android如果动态改变CursorAdapter Item个数
//adapter内部类 private class SearchAdapter extends CursorAdapter { @Override public View newView(Conte ...
- Hero In Maze
Hero In Maze 时间限制(普通/Java):1000MS/10000MS 执行内存限制:65536KByte 描写叙述 500年前,Jesse是我国最卓越的剑客. 他英俊潇 ...
- Gym - 100341C FFT优化DP
题目链接:传送门 题解: 设定dp[i][j]在深度为i下,使用j个节点的方案数 显然的转移方程组就是 dp[h][n] = dp[h-1][i] * dp[h-1][n-i-1] + 2*dp[h- ...
- 4408: [Fjoi 2016]神秘数
4408: [Fjoi 2016]神秘数 Time Limit: 10 Sec Memory Limit: 128 MB Submit: 452 Solved: 273 [Submit][Stat ...
- DOM操作三
1.以一个对象的x和y属性的方式返回滚动条的偏移量 function getScrollOffsets(w){ //使用指定的窗口,如果不带参数则使用当前窗口 w= w || window; //除了 ...
- php网站前台utf-8格式有时会出现莫名其妙的空白行,重新保存下编码格式就可以了
php网站前台utf-8格式有时会出现莫名其妙的空白行,重新保存下编码格式就可以了.
- usaco2008 nov 区间异或求和
Problem 11: Switching Lights [LongFan, 2008] Farmer John tries to keep the cows sharp by letting the ...
- model.js
var Model = { inherited: function () {}, created: function () {}, prototype: { init: function (attrs ...
- ASP.NET Session and Forms Authentication and Session Fixation
https://peterwong.net/blog/asp-net-session-and-forms-authentication/ The title can be misleading, be ...