UVA11437

简介: 题目: In the picture below you can see a triangle ABC. Point D, E and F divides the sides BC, CA and AB into ratio 1:2 respectively.

题目:

In the picture below you can see a triangle ABC. Point D, E and F divides the sides BC, CA and AB into ratio 1:2 respectively. That is CD=2BD, AE=2CE and BF=2AF. A, D; B, E and C, F are connected. AD and BE intersects at P, BE and CF intersects at Q and CF and AD intersects at R.

So now a new triangle PQR is formed. Given triangle ABC your job is to find the area of triangle PQR.


代码:


#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
//    freopen("in.txt", "r", stdin);
    int n;
    scanf("%d", &n);
    int id = 1;
    for(; id<=n; id++){
        double ax, ay, bx, by, cx, cy;
        cin >> ax >> ay >> bx >> by >> cx >> cy;
        double a = sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy));
        double b = sqrt((ax-cx)*(ax-cx)+(ay-cy)*(ay-cy));
        double c = sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
        double p = (a+b+c)/2;
        double area = sqrt(p*(p-a)*(p-b)*(p-c))/7;
        int ans = floor(area+0.5);
        cout << ans << endl;
    }
    return 0;
}



目录
相关文章
|
8月前
uva10038 Jolly Jumpers
uva10038 Jolly Jumpers
23 0
|
8月前
Uva10001 Garden of Eden
Uva10001 Garden of Eden
32 0
|
8月前
UVa10123 No Tipping
UVa10123 No Tipping
38 0
UVa 10082 WERTYU
UVa 10082 WERTYU
100 0
概率dp - UVA 11021 Tribles
Tribles  Problem's Link:  http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=33059   Mean:  有k个细菌,每个细菌只能存活一天,在死去之前可能会分裂出0,1,2....n-1个细菌,对应的概率为p0,p1,p2....pn-1。
797 0
|
机器学习/深度学习 人工智能
uva 10870 Recurrences
点击打开uva 10870 思路:构造矩阵+矩阵快速幂 分析: 1 题目给定f(n)的表达式 f(n) = a1 f(n - 1) + a2 f(n - 2) + a3 f(n -3) + .
716 0
uva 1203 Argus
点击打开链接uva 1203 思路: 优先队列 分析: 1 题目要求前k个事件的编号,我们利用优先队列来维护即可 2 优先队列保存的是一个struct,因此我们需要重载 s.
1278 0
|
人工智能
uva 10189 Minesweeper
/* Minesweeper WA了n次才知道uva格式错了也返回wa没有pe啊尼玛 */ #include&lt;iostream&gt; #include&lt;stdio.h&gt; #include&lt;string.h&gt; using namespace std; char a[105][105]; int main() { int i,j,n,m,
915 0
|
JavaScript 定位技术
uva 10047 - The Monocycle
点击打开链接uva 10047 思路:bfs 分析: 1 题目给定一个起始的状态然后要求是否可以到达目标状态 2 这些状态包括了位置,方向,底面颜色。
827 0