HDU1071 The area 【积分】
The area
can you tell Ignatius the area of the land?
Note: The point P1 in the picture is the vertex of the parabola.

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).
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
33.33
40.69HintFor float may be not accurate enough, please use double instead of float.
题意:给定一个抛物线的顶点P1坐标和另外两点坐标P2、P3,以及一条穿过P2、P3的直线。求直线与抛物线围城的面积。
题解:每次做磊哥出的题总会学到些新东西。这次也不例外。这是我第一次做积分的题。高数总算是没白学。可是已知抛物线三点坐标求抛物线的方程我愣是没解出来,感觉太复杂了,在网上找的别人推出好的公式:url=5T1k83zKP81FREbVbn3gBx0bF-AqBIEYoKwcA60fcMhZfVXng4twTqkBxgvOUo2ovkKpe3m2cabE9mgqvTZNva">click
here
here
#include <stdio.h> int main()
{
int t;
double x1, y1, x2, y2, x3, y3, a, b, c, k, d, p, q, r, ans;
scanf("%d", &t);
while(t--){
scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
p = y1 / ((x1 - x2) * (x1 - x3));
q = y2 / ((x2 - x1) * (x2 - x3));
r = y3 / ((x3 - x1) * (x3 - x2));
a = p + q + r;
b = -p*(x2 + x3) - q*(x1 + x3) - r * (x1 + x2);
c = p * x2 * x3 + q * x1 * x3 + r * x1 * x2;
k = (y3 - y2) / (x3 - x2);
d = y2 - k * x2;
ans = (1.0/3*a*x3*x3*x3 + 1.0/2*(b-k)*x3*x3 + (c-d)*x3) -
(1.0/3*a*x2*x2*x2 + 1.0/2*(b-k)*x2*x2 + (c-d)*x2);
if(ans < 0) ans = -ans;
printf("%.2lf\n", ans);
}
return 0;
}
HDU1071 The area 【积分】的更多相关文章
- The area 积分积分
The area Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Sta ...
- HDU1071 The area
Ignatius bought a land last week, but he didn't know the area of the land because the land is enclos ...
- The area (hdu1071)积分求面积
The area Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- HDU - 1071 - The area - 高斯约旦消元法 - 自适应辛普森法积分
http://acm.hdu.edu.cn/showproblem.php?pid=1071 解一个给定三个点的坐标二次函数某区域的积分值. 设出方程之后高斯消元得到二次函数.然后再消元得到直线. 两 ...
- SPOJ CIRU The area of the union of circles ——Simpson积分
[题目分析] 圆的面积并. 直接Simpson积分,(但是有计算几何的解法,留着flag). simpson积分,如果圆出现了不连续的情况,是很容易出事情的.(脑补一下) 但是没有什么办法,本来就是一 ...
- 杭电1071-The area
问题描述: Ignatius bought a land last week, but he didn't know the area of the land because the land i ...
- HDU_1071——积分求面积,抛物线顶点公式
Problem Description Ignatius bought a land last week, but he didn't know the area of the land becaus ...
- hdu 5954 -- Do not pour out(积分+二分)
题目链接 Problem Description You have got a cylindrical cup. Its bottom diameter is 2 units and its heig ...
- 【自适应辛普森积分】hdu1724 Ellipse
Ellipse Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...
随机推荐
- RapidCRC : Home
RapidCRC : Home What is RapidCRC? RapidCRC is a tool for windows for checking and creating CRC32 a ...
- android程序中使用命令行及获得命令行执行后的内容
在开发android项目中,需要在程序中使用命令行执行,获得命令行执行后的结果并做处理. 下面是自己写的一个小例子,供以后参考使用: public String android_command(){ ...
- Xamainr 地图之webview初探
一 说几点 当下移动开发主要实现方式有传统的Native以及新的混合开发想Rect.js,nodejs这些前段框架,其本质要么是原生控件来实现UI,要么html来实现UI.Xamarin其实也只是取巧 ...
- Linux多线程编程的时候怎么查看一个进程中的某个线程是否存活
pthread_kill: 别被名字吓到,pthread_kill可不是kill,而是向线程发送signal.还记得signal吗,大部分signal的默认动作是终止进程的运行,所以,我们才要用sig ...
- MS Project 2007 工期、工时、资源、固定单位、固定工期、固定工时
0. 基本概念 工期:指完成每项项目任务所经历的实际时间,及开始日期和结束时期之差.Project中,工期的默认单位是天. 工时:指将任务分配给资源后,每个资源执行任务的工作时间.Project中,工 ...
- 【COCOS2DX-游戏开发之三三】TMX边界控制与小窗体内预览TMX
做一款像素游戏,须要确定地图的边界.保证人物的位置位于屏幕中央.到达地图左边界.地图位置不变.人向左走,到达右边界,地步位置不变,人向右走 如:地图左边.右边,上边空出的边界.还有下方留出操作butt ...
- javascript启示录英文单词生词
odd:奇怪的 represent:代表 primitive:原始的 trivial:平凡的 demonstrate:证明 keep this at the forefront of your min ...
- maven项目配置Project Facets时further configuration available不出来问题
如果下边的 further configuration available不出来 把Dynamic web module 去掉勾选,应用与项目,然后再点开项目的properties,再选中Dynami ...
- 44个JAVA代码质量管理工具(转)
1. CodePro AnalytixIt’s a great tool (Eclipse plugin) for improving software quality. It has the nex ...
- Linux下一个简单的日志系统的设计及其C代码实现
1.概述 在大型软件系统中,为了监测软件运行状况及排查软件故障,一般都会要求软件程序在运行的过程中产生日志文件.在日志文件中存放程序流程中的一些重要信息, 包括:变量名称及其值.消息结构定义.函数返回 ...