UVA-10061 how many Zero's and how many digits?

Source: Internet
Author: User

http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19099

Given some points, the maximum area of the triangle is formed, and the triangle cannot contain other points (not on the edge).

Because the data range is small, the direct enumeration is good, and the area formula tells us that the method of judging the point in the triangle is that the sum of the area of the point and other vertices is equal to the area of the triangle.

#include <cstdio> #include <cmath>struct point{char z; int x, y;} P[20];d ouble Area (point A,point b,point c) {return fabs (0.5* (C.Y-A.Y) * (b.x-a.x)-(B.Y-A.Y) * (c.x-a.x));}    BOOL Check (point a,point b,point c,point D) {if (area (a,b,d) +area (b,d,c) +area (a,d,c)) ==area (A,B,C)) return 1; else return 0;}    int main () {//freopen ("A.txt", "R", stdin);    int n,i,j,k,l;        while (~SCANF ("%d", &n)} {if (n==0) break;        GetChar ();            for (i=0;i<n;i++) {scanf ("%c%d%d", &p[i].z,&p[i].x,&p[i].y);            printf ("%c%d%d\n", p[i].z,p[i].x,p[i].y);        GetChar ();        } double s,sum=0;        Char a,b,c;                for (i=0;i<n;i++) {for (j=i+1;j<n;j++) {for (k=j+1;k<n;k++)                    {S=area (p[i],p[j],p[k]);             if (s>sum) {for (l=0;l<n;l++) {               if (L!=i&&l!=j&&l!=k&&check (P[i],p[j],p[k],p[l])) break;                            } if (l==n) {sum=s;                            A=p[i].z;                            B=p[j].z;                        C=p[k].z;    }}}}} printf ("%c%c%c\n", a,b,c); } return 0;}


UVA-10061 how many Zero's and how many digits?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.