zoukankan      html  css  js  c++  java
  • uva 11437 Triangle Fun

    原题链接:

    我的来源:2012.11.11CSUST Warm Up(Preparing for the 2013 )(personal):http://acm.hust.edu.cn:8080/judge/contest/view.action?cid=16690#problem/I

    I - Triangle Fun
    Time Limit:1000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu

    Description

    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.

    Input

    First line of the input file contains an integer N (0<N<1001) which denotes how many sets of inputs are there. Input for each set contains six floating-point number Ax, Ay, Bx, By, Cx, Cy. (0≤Ax, Ay, Bx, By, Cx,Cy ≤10000) in one line line. These six numbers denote that the coordinate of points A, B and C are (Ax, Ay), (Bx, By) and (Cx, Cy) respectively. A, B and C will never be collinear.

    Output

    For each set of input produce one line of output. This one line contains an integer AREA. Here AREA is the area of triangle PQR, rounded to the nearest integer.

    Sample Input

    2
    3994.707 9251.677 4152.916 7157.810 5156.835 2551.972
    6903.233 3540.932 5171.382 3708.015 213.959 2519.852

    Sample Output

    98099
    206144

    题目大意:任意△ABC中F、D、E分别为三边的三等分点中点,将其分别与对应的顶点相连,得到一个新的△RPQ。

                    现在给出△ABC的坐标,求△RPQ的面积

    解题思路:用叉积求出△ABC的面积三角形 ABC 的面积= |AxBy - AyBx + BxCy - ByCx + CxAy - CyAx| / 2

                      叉积:   Ax   Ay  1

                                     Bx   By    1     =   AxBy - AyBx + BxCy - ByCx + CxAy - CyAx

                                     Cx   Cy    1

                      可以证明:S△BPQ :S△ABC = 1 : 7

                       PS:只会证明正三角形的,so这道题目也算是水过的了ORz。。。

                               第一个证明是正三角形的,第二个证明是普通三角形的(感谢江,全能的数学啊!)

                               下面给出正三角形的证明:

                    如图所示:1、由正三角形的对称性知道S△AFR=S△BDP=S△CQE=S1

                                                                             S△BFR=S△CDP=S△AQE=S2

                                                                             S△BPR=S△AQR=S△CPQ=S3

                                      2、△ABC中D为边BC的三等分点,BD :BC = 1 : 3 所以S△ABD :S△ABC = 1 : 3

                                            3*S△ABD=S△ABD+S△BCE+S△CAF=S△ABC易得3*S1=S0

                                      3、△BPC中BD : DC =1 : 2,所以S1:S2=1 :2,所以S1+S2=S0

                                      4、在△BRC中S△BRQ=S0+S3

                                                               S△BCQ=(S1+S2)+S3=S0+S3

                                                               所以:S△BRQ=S△BCQ,即Q为RC的中点,那么在△PRC中可知S0=S3

                                     综上所述:S0=S3=S1+S2,所以S0 :S△ABC=1 :7

                          普通三角形证明方法

      


                                                                                           

                                      如图所示AG∥BCBE延长线于点G,作DH∥ABCF于点H, 

                     则得:AGBC=AEEC=12APPD=AGBD=34   *****************1

                     又由于DHBF=13DHAF=16,  

                     所以DRAR=16DRDA=17,  ********************************2

    /****************************************************************************************************

    PS:到了此处如果,不追究严格的论证方法,应该可以直接看出:

                                       S△CDR=1/7S△BFC=1/21S△ABC

      因此S△PQRS△ABC=17  即:S△PQR=1/7S△ABC=1/7

    /*****************************************************************************************************

    下面还是给出严格的证明过程:

                            由(1)(2)有APPR = 3 即 PAR的中点。

                            同理可得QBP中点,RCQ中点。


                           连接AQCPBR

                           在△AQR中,PAR中点,所以由同底等高得S△AQP=S△RQP

                                                  同理有S△PQR=S△BQR=S△CPR=S△AQR   **************************3

                           因为FDE分别为三角形三条边的三等分点

                           所以S△ABE=S△CBF=S△ADC=1/3*S△ABC (底在同一条线上,高相等)

                           所以S△ABE+S△CBF+S△ADC=S△ABC  ****************************4

                           而(4)中三个小三角形△BFQ△AEP△CDR加了两次,但是△PQR没有加

                           所以△BFQ + △AEP + △CDR = △PQR  ******************************5

                           而在△BRCDC : BC = 1 3

                                                   得到S△CDR S△BCR= 1 3

                                                   同理S△BFQ S△BAQ=1 3

                                                           S△AEP S△ACP= 1 3

                                                 所以由(5)有S△BAQ + S△ACP + S△BCR = 3*(△BFQ + △AEP + △CDR)  

                                                                                                                         =3*S △PQR                ***********************(6)

                                                 由(3)(6)得到S△PQR=1/7S△ABC


    #include<stdio.h>
    int main()
    {
        int n;
        double Ax,Ay,Bx,By,Cx,Cy;
        double are;
        while(scanf("%d",&n)!=EOF)
        {
            while(n--)
            {
                scanf("%lf%lf%lf%lf%lf%lf",&Ax,&Ay,&Bx,&By,&Cx,&Cy);
                are=(Ax*By+Bx*Cy+Cx*Ay-Ay*Bx-By*Cx-Cy*Ax)/(2*7);
                are>=0?are:-are;
                printf("%.0lf\n",are);
            }
        }
        return 0;
    }
    

      

  • 相关阅读:
    黑客悬赏活动第二期 | 百万ELF赏金,aelf跨链转账标准协议CCTP等你挑战!
    2020年aelf首场全民公测,有奖狂欢四重好礼大放送!
    使用aelf最新稳定测试币AEUSD试玩BingoGame Demo,赢取体验奖金!
    开发者大赛 | aelf轻型DApp开发训练大赛结果公布!
    黑客赏金第一期 | aelf跨链转账标准协议准备就绪,88888ELF赏金等你挑战!
    Twitter AMA预告 | aelf 创始人马昊伯将以【aelf治理与发展】为主题进行在线答疑!
    aelf Enterprise 1.0.0 Preview 2 版正式发布!
    aelf技术点解读 | 分红合约接口实现方案
    深入浅出索引--Mysql45讲笔记记录 打卡day3
    一条SQL语句是如何执行的?--Mysql45讲笔记记录 打卡day1
  • 原文地址:https://www.cnblogs.com/freezhan/p/2776472.html
Copyright © 2011-2022 走看看