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;
}



目录
相关文章
uva 10340 all in all
输入两个字符串s和t,判断是否可以从t中删除0个或多个字符(其他字符顺序不变),得到字符串是。
45 0
UVa11968 - In The Airport
UVa11968 - In The Airport
59 0
UVa11776 - Oh Your Royal Greediness!
UVa11776 - Oh Your Royal Greediness!
58 0
uva10152 ShellSort
uva10152 ShellSort
65 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。
833 0
uva 10273 Eat or Not to Eat?
点击打开链接uva 10273 思路: 暴力求解 分析: 1 题目要求没有吃掉的奶牛的个数已经最后一次吃掉奶牛的天数 2 没有其它的方法只能暴力,对于n头牛的n个周期求最小公倍数,然后在2个公倍数之内暴力求解 代码: #inclu...
832 0