Calculate the hdu1071the area of the mathematical points

Source: Internet
Author: User
/* Question address: http://acm.hdu.edu.cn/showproblem.php? PID = 1071 click to open the link question: Using points for area experience: some library functions can not be renamed with them, the name is also very important, X1, y1 and map cannot be arbitrarily named */# include <iostream> # include <cstring> # include <cstdio> # include <cmath> // I didn't expect that x1 exists in cmath., y1. you cannot directly compile using namespace STD; Double A, A1, B1; double X11, y11, x22, y22, x33, y33; double cal1 (Double X) // calculate the parabolic function value {return a * (x-x11) * (x-x11) + y11;} double cal2 (Double X) // calculate the function value of the straight line {return A1 * x + b1;} int main () {int t; CIN> T; while (t --) {scanf ("% lf", & X11, & y11, & x22, & y22, & x33, & y33 ); if (x22> x33) {Double P = x22; x22 = x33; x33 = P; P = y22; y22 = y33; y33 = P;} A = (y22-y11) /(x22-x11) * (x22-x11); a1 = (y22-y33)/(x22-x33); b1 = (x33 * y22-x22 * y33)/(x33-x22); double S = 0; double I; for (I = x22; I <= x33; I + = 0.00005) // obtain the area S + = (FABS (cal1 (I) -cal2 (I) * 0.00005; printf ("%. 2f \ n ", S);} return 0 ;}

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.