HDU 2.1.7 (求定积分公式)
The area | 
| Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) | 
| Total Submission(s): 1637 Accepted Submission(s): 1298 | 
| 
 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: 
  | 
| 
 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  | 
| 
 Sample Output 
33.33 Hint 
For float may be not accurate enough, please use double instead of float.  | 
| 
 Author 
Ignatius.L 
 | 
求定积分公式
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
using namespace std;
double a,b,c;
double f(double x)
{
return 1.0/*a*x*x*x+0.5*b*x*x+c*x;
}
int main()
{
double x1,y1,x2,y2,x3,y3;
int n;
cin>>n;
while(n--)
{
cin>>x1>>y1>>x2>>y2>>x3>>y3;
a=(y2-y1)/((x2-x1)*(x2-x1)); //顶点式求a
b=-*a*x1; //对称轴求b
c=y1-a*x1*x1-b*x1; //一般式求c
printf("%.2lf\n",f(x3)-f(x2)-(y3+y2)*(x3-x2)/); //定积分
}
return ;
}
HDU 2.1.7 (求定积分公式)的更多相关文章
- HDOJ1021题 Fibonacci Again   应用求模公式
		
Problem Description There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) ...
 - C语言复习---矩形法求定积分函数
		
一:分析: 大一学习积分的时候,我们学习过,可以通过矩形法来求定积分. 思路就是将积分区间划分成n等份,然后将这n等份近似看成矩形(或梯形),然后对所有的矩形(或梯形)的面积进行求和. 二:简单的例子 ...
 - 牛客训练二:处女座的签到题(STL+精度+三角形求面积公式)
		
题目链接:传送门 知识点: (1)三个点,三角形求面积公式 (2)精度问题: double 15-16位(参考文章) float 6-7位 long long 约20位 int 约10位 unsign ...
 - matlab求定积分和不定积分
		
matlab求定积分与不定积分 创建于2018-03-21 22:42 求定积分与不定积分是一件比较繁琐的事,但是我们可以借助matlab,下面与大家分享解决方法 材料/工具 matlab 求不定积分 ...
 - YTU 2421: C语言习题 矩形法求定积分
		
2421: C语言习题 矩形法求定积分 时间限制: 1 Sec 内存限制: 128 MB 提交: 354 解决: 234 题目描述 写一个用矩形法求定积分的通用函数,分别求 (说明: sin,co ...
 - 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 \) ...
 - simpson公式求定积分(模板)
		
#include<cstdio> #include<cmath> #include <algorithm> using namespace std; double ...
 - HDU 1568 Fibonacci【求斐波那契数的前4位/递推式】
		
Fibonacci Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Proble ...
 - 题解报告:hdu 1124 Factorial(求N!尾数有多少个0。)
		
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1124 Problem Description The most important part of a ...
 
随机推荐
- SOM自组织映射网络 教程
			
概述 SOM是芬兰教授Teuvo Kohonen提出的一种神经网络算法,它提供一种将高维数据在低维空间进行表示的方法(通常是一维或二维).缩减向量维度的过程,叫做向量量化(vector quantis ...
 - 【BZOJ-1449&2895】球队收益&球队预算    最小费用最大流
			
1449: [JSOI2009]球队收益 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 648 Solved: 364[Submit][Status][ ...
 - TCP/IP详解 学习四
			
ARP地址解析协议 当一台主机把以太网数据帧发送到位于同一局域网上的另一台主机时,是根据 48 bit的以太网地址来确定目的接口的.设备驱动程序从不检查 I P数据报中的目的 I P地址. ARP的分 ...
 - workon在zsh中不起作用
			
先装了workon,然后装了zsh,发现在zsh里不起作用 翻了一下网上没有解答,就看了看bashrc文件,发现一句 source /usr/local/bin/virtualenvwrapper.s ...
 - Mac OS X 10.9 Mavericks安装后,Xcode调试时模拟器黑屏的处理方法
			
请耐心的等下去吧,少年! 装了Mac OS X 10.9 Mavericks的同学,如果碰到Xcode调试App时,模拟器黑屏(重置也无效),请耐心的等下去吧,大约10来分钟左右黑屏就会消失,App启 ...
 - 栈的的链式实例LinkStack实现
			
1.#include <stdio.h>#include <malloc.h>#include "LinkList.h"typedef struct _ta ...
 - The C Programming Language (second edition) 实践代码(置于此以作备份)
			
1. #include <stdio.h> #include <stdlib.h> #include <math.h> #include<time.h> ...
 - java 小记
			
1.获取web项目根目录的绝对路径 request.getContextPath() 获取项目名称,如 /BiYeSheJi getServletContext().getRealPath(& ...
 - Java基础之理解Annotation(与@有关,即是注释)
			
Java基础之理解Annotation 一.概念 Annontation是Java5开始引入的新特征.中文名称一般叫注解.它提供了一种安全的类似注释的机制,用来将任何的信息或元数据(metadata) ...
 - WinsockExpert+NC抓包上传之拿WEBSHELL
			
知识补充: nc上传漏洞在原理上同动网上传漏洞一样,都是利用计算机在读取字符串时,遇到'\0'(00)时,认为字符串结束了,从而丢掉后面的字符串,正如unicode编码特性一样,可被人利用,尽管在这里 ...
 
			
		