数学—杭电1071 The area
来源:互联网 发布:linux 打包一个文件夹 编辑:程序博客网 时间:2024/06/06 13:16
http://acm.hdu.edu.cn/showproblem.php?pid=1071
The area
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7099 Accepted Submission(s): 4986
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.
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).
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
25.000000 5.0000000.000000 0.00000010.000000 0.00000010.000000 10.0000001.000000 1.00000014.000000 8.222222
Sample Output
33.3340.69HintFor float may be not accurate enough, please use double instead of float.
#include <iostream>#include <iomanip>using namespace std;int main(){ double x1,x2,x3,y1,y2,y3,k,h; int n,i; cin>>n; for(i=1;i<=n;i++) { cin>>x1>>y1; cin>>x2>>y2; cin>>x3>>y3; k=(y2-y3)/(x2-x3); h=y2-k*x2; double a,b,c; a=(y2-y1)/((x2-x1)*(x2-x1)); b=-2*a*x1; c=y1-a*x1*x1-b*x1; double sum; sum=a/3*(x3*x3*x3-x2*x2*x2)+(b-k)/2*(x3*x3-x2*x2)+(c-h)*(x3-x2); cout<<setiosflags(ios::fixed)<<setprecision(2)<<sum<<endl; } return 0;}
0 0
- 数学—杭电1071 The area
- 杭电1071——The area!
- 杭电1071 The area
- 杭电1071 The area
- 杭电1071 The area
- 杭电 1071 The area 题解报告
- 杭电ACM-The area
- 杭电oj problem1071 the area
- HDU 1071 The area (数学水题)
- HDU 1071 The area(数学 抛物线 积分)
- 1071—The area
- hdu 1071 The area(数学--抛物线)
- 数学—杭电1405 The Last Practice
- 数学——Area
- 1071 The area
- hdu 1071 The area
- (hdu 1071)The area
- hdu 1071 The area
- c语言中读取命令行参数
- 新xcode的literal syntax是什么
- iOS开发- UICollectionView详解+实例
- 动态链表队列--内存溢出异常-和边界溢出
- SharePoint 沙盒解决方案部署无法启动计算机服务SPUserCodeV4
- 数学—杭电1071 The area
- C#如何获得屏幕尺寸大小
- 判断一条直线到另一条直线所构成的角度是逆时针还是顺时针方向。
- ASP.NET中进行消息处理(MSMQ)
- ios学习推荐博客
- fillMode的意义
- android wear 的起步介绍, 搭建开发预览环境
- MEF程序设计指南七:使用目录(Catalog)动态装载xap与目录筛选(Filtered Catalog)
- 关于OpenFileDialog的使用