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. linux 使用kill命令杀死进程的几个办法

    常规篇: 首先,用ps查看进程,方法如下: $ ps -ef ……smx       1822     1  0 11:38 ?        00:00:49 gnome-terminalsmx   ...

  2. Android:监听ListView

    本文目录 监听ListView点击事件 监听ListView滚动事件 监听ListView点击事件 使用监听器OnItemClickListener package com.example.tests ...

  3. MyBatis的动态SQL操作--更新

    更新条件不确定,需要根据具体的情况生成sql语句. id是主键,一般不会去更新. 1.只更新name的值 update student set name = ? where id = ? 2.只更新s ...

  4. 96. Unique Binary Search Trees

    题目: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For e ...

  5. 如何快速查看linux的发行版信息

    思路一: 在CentOS中想查看发行版信息,输入了lsb_release -a 命令却报错了,通过输入以下命令进行安装 yum install redhat-lsb -y 然后继续查看发行版信息 [r ...

  6. 统计 p-value 含义

    p-value是一种概率:在原假设为真的前提下,出现该样本或比该样本更极端的结果的概率之和. 例子: 我们假设 H0:出现正面的概率是1/2 扔硬币20次出现了14次正面.该样本的单边p-value计 ...

  7. CSS和JavaScript以及Ajax实现预加载图片的方法及优缺点分析

    预加载图片是提高用户体验的一个很好方法.图片预先加载到浏览器中,访问者便可顺利地在你的网站上冲浪,并享受到极快的加载速度.这对图片画 廊及图片占据很大比例的网站来说十分有利,它保证了图片快速.无缝地发 ...

  8. 【HDOJ】5296 Annoying problem

    LCA+RMQ.挺不错的一道题目. 思路是如何通过LCA维护费用.当加入新的点u是,费用增量为dis[u]-dis[lca(u, lower_u)] - dis[lca(u, greater_u)] ...

  9. I.MX6 U-boot Kernel backlight setting

    /********************************************************************* * I.MX6 U-boot Kernel backlig ...

  10. Android UI设计系统-android selector 开始自定义样式

    Selector的结构描述: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:a ...