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 ...
随机推荐
- Linux epoll 源码注释
https://www.cnblogs.com/stonehat/p/8613505.html 这篇文章值得好好读,先留个记录,回头看. IO多路复用之epoll总结 - Anker's Blog - ...
- QT实现FTP服务器(二)
QClientThread类的实现: #include "QClientThread.h" #include <QDebug> /******************* ...
- Ruby中任务构建工具rake的入门学习教程
参考:http://www.jb51.net/article/81476.htm Rake简介 Rake的意思是Ruby Make,一个用ruby开发的代码构建工具. 但是,为什么Ruby需要Rake ...
- codeforces 440B. Balancer 解题报告
题目链接:http://codeforces.com/problemset/problem/440/B 题目意思:给出 n 个数,求出这 n 个数的平均值avg,问对于这 n 个数里面中的每一个数,要 ...
- html5--6-56 阶段练习5-翻转效果
html5--6-56 阶段练习5-翻转效果 学习要点 运用所学过的知识完成一个简单的小练习,理解对动画的应用. @charset="UTF-8"; *{ ; ; } img{ w ...
- 使用TextView实现跑马灯的效果
1.定义textView标签的4个属性: android:singleLine="true"//使其只能单行 android:ellipsize="marquee&quo ...
- 【ZJOI 2008】树的统计
[题目链接] 点击打开链接 [算法] 树链剖分模板题 [代码] #include<bits/stdc++.h> using namespace std; #define MAXN 3000 ...
- 【iOS】KVC 和 KVO 的使用场景
http://blog.csdn.net/chenglibin1988/article/details/38259865 Key Value Coding Key Value Coding是coc ...
- 使用putty连接虚拟机上的centos提示Network:connection refused
转自:https://yeyuan.iteye.com/blog/1266484 今天早上开机之后,像往常一样使用putty连接linux的时候,突然提示Network:connection refu ...
- (bmp格式)用CDialog的OnCtlColor()消息响应处理背景画刷。
(bmp格式)用CDialog的OnCtlColor()消息响应处理背景画刷. 加载位图资源IDB_BITMAP1,在Dlg类头文件中加入: CBrush m_brush; 在OnInitDialog ...