The area

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8388    Accepted Submission(s):
5888

Problem Description
Ignatius bought a land last week, but he didn't know
the area of the land because the land is enclosed by a parabola and a straight
line. The picture below shows the area. Now given all the intersectant points
shows in the picture, can you tell Ignatius the area of the land?

Note:
The point P1 in the picture is the vertex of the parabola.

 
Input
The input contains several test cases. The first line
of the input is a single integer T which is the number of test cases. T test
cases follow.
Each test case contains three intersectant points which shows
in the picture, they are given in the order of P1, P2, P3. Each point is
described by two floating-point numbers X and
Y(0.0<=X,Y<=1000.0).
 
Output
For each test case, you should output the area of the
land, the result should be rounded to 2 decimal places.
 
Sample Input
2
5.000000 5.000000
0.000000 0.000000
10.000000 0.000000
10.000000 10.000000
1.000000 1.000000
14.000000 8.222222
 
Sample Output
33.33
40.69
 
就是一道数学题,做题的时候看错了一个坐标  结果看了好长时间没发现  坑~~~~
#include<stdio.h>
#include<math.h>
int main()
{
int N;
double a,b,c,d,k,x1,y1,x2,y2,x3,y3,s;
scanf("%d",&N);
while(N--)
{
s=0;
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
a=((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3))/((x1*x1-x3*x3)*(x1-x2)-(x1*x1-x2*x2)*(x1-x3));
d=((y1-y3)-a*(x1*x1-x3*x3))/(x1-x3);
c=y1-a*x1*x1-d*x1;
k=(y2-y3)/(x2-x3);
b=y3-k*x3;
s=((a*x3*x3*x3)/3+((d-k)*x3*x3)/2+(c-b)*x3)-((a*x2*x2*x2)/3+((d-k)*x2*x2)/2+(c-b)*x2);
printf("%.2lf\n",s);
}
return 0;
}

  

hdoj 1071 The area的更多相关文章

  1. HDU 1071 The area(求三个点确定的抛物线的面积,其中一个点是顶点)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1071 The area Time Limit: 2000/1000 MS (Java/Others)  ...

  2. 【HDOJ】1071 The area

    数学题,先求抛物线和直线的系数,再利用积分公式求面积. #include <stdio.h> #include <math.h> int main() { double x1, ...

  3. HDU - 1071 - The area - 高斯约旦消元法 - 自适应辛普森法积分

    http://acm.hdu.edu.cn/showproblem.php?pid=1071 解一个给定三个点的坐标二次函数某区域的积分值. 设出方程之后高斯消元得到二次函数.然后再消元得到直线. 两 ...

  4. HDU 1071 - The area

    求曲线和直线围成的面积 求表达式,求积分 #include <iostream> using namespace std; ],y[]; int t; double k,m;//fx1: ...

  5. HDU ACM 1071 The area 定积分计算

    分析: 1.求抛物线方程F(x)=a*x^2+b*x+c: 2.求直线方程f(x)=k*x+b. 3.利用定积分计算F(x)-f(x)在x2到x3之间的面积. #include<iostream ...

  6. HDU 1071 The area (数学定积分)

    题意:求阴影部分面积. 析:没什么可说的,就是一个普通的定积分. 代码如下: #include <cstdio> #include <iostream> using names ...

  7. HDU 1071 The area ——微积分

    [题目分析] 求二次函数和一次函数围成的面积. 先解方程求出一次函数和二次函数. 然后积分. 现在还是不会积分. [代码] #include <cstdio> #include <c ...

  8. hdu 1071 The area【定积分】

    用顶点式\( a(x-h)^2+k=y \)解方程,转化为\(ax^2+bx+c=y \)的形式,然后对二次函数求定积分\( \frac{ax^3}{3}+\frac{bx^2}{2}+cx+C \) ...

  9. Simpson公式的应用(HDU 1724/ HDU 1071)

    辛普森积分法 - 维基百科,自由的百科全书 Simpson's rule - Wikipedia, the free encyclopedia 利用这个公式,用二分的方法来计算积分. 1071 ( T ...

随机推荐

  1. APK签名校验绕过

    APK签名校验绕过 Android JNI 获取应用签名 android apk 防止反编译技术第一篇-加壳技术 android apk 防止反编译技术第五篇-完整性校验 利用IDA Pro反汇编程序 ...

  2. hadoop2.2.0安装

    64位编译和安装 http://blog.csdn.net/licongcong_0224/article/details/12972889 http://blog.csdn.net/w1377026 ...

  3. 关于C的一些理解

    关于字符数组和字符指针 关于相互赋值问题一只有疑问,其实是自己搞不清指针和地址的关系.地址可以指向一块内存但是不一定存在于内存,比如字符数组名,数组名是地址,但是不实际存在于内存中,无法修改,而字符指 ...

  4. Android开发之布局的学习

    FrameLayout-帧布局 实现效果: 代码: <?xml version="1.0" encoding="utf-8"?> <Frame ...

  5. POJ2892Tunnel Warfare (线段树)

    http://poj.org/problem?id=2892 记录每个区间端点的左连续及右连续 都是单点更新 用不着向下更新 还简单点 找错找了N久 最后发现将s[w<<1|1]写成s[w ...

  6. 解决windows下vim方向键变成 ABCD 的问题

    一.问题描述: windows下面要安装git --> 安装了 msys2 -->安装并更新了 vim(7.4),然后在使用过程中发现vim不能使用  BACKSPACE 键,按方向键会打 ...

  7. poj 3393 Lucky and Good Months by Gregorian Calendar(模拟)

    题目:http://poj.org/problem?id=3393一道题目挺长的模拟题,参考了网上大神的题解. #include <iostream> #include <cstdi ...

  8. Java和.NET在开发中的不同盘点

    我是用VS2008和VS2010开发.NET程序,通过MyEclipse8.5开发JAVA程序,下面从IDE.语言.插件的不同点来做下简单的说明.但由于经验知识还有限,本篇文章只能从比较表面的以及自己 ...

  9. jquery自动生成分页控件 - pagetest.js

    /* pagenum:当前页数 theallnum:总条数 themeiye:每页显示多少条 */ function pagetest(pagenum, theallnum, themeiye) { ...

  10. 【开源专访】Sea.js创始人玉伯的前端开发之路

    摘要:玉伯,淘宝前端类库 KISSY.前端模块化开发框架SeaJS.前端基础类库Arale的创始人.本期[开源专访]我们邀请玉伯来为我们分享一些关于前端框架.前端开发的那些事,以及前端大牛是如何炼成的 ...