HDU 1071 The area(计算几何)
来源:互联网 发布:结构分析软件 编辑:程序博客网 时间:2024/05/22 07:06
Description
二维平面有一条直线与一条开口向下的抛物线相交,现在给出抛物线顶点以及两个交点,求出直线与抛物线围成的面积,保证数据合法
Input
第一行为用例组数T,每组用例占三行分别输入抛物线顶点P1,左交点P2以及右交点P3的横纵坐标
Output
输出直线与抛物线围成的面积
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
Solution
设抛物线方程为,带入点(x3,y3)得,由两交点得到直线,所以直线与抛物线围成的面积
Code
#include<cstdio>#include<iostream>#include<cmath>using namespace std;int main(){ double x1,x2,x3,y1,y2,y3; int t; scanf("%d",&t); while(t--) { scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3); double ans=0; ans=(y1-y3)*(x3-x2)-(y1-y3)*(pow(x3-x1,3)-pow(x2-x1,3))/(3.0*pow(x3-x1,2))+(y3-y2)*(x3-x2)/2.0; printf("%.2lf\n",ans); } return 0;}
0 0
- HDU 1071 The area(计算几何)
- HDU 1071 The area(计算几何)
- HDU 1071 The area(微积分 计算几何)
- Hdu 1071 The area 利用计算几何求面积
- HDU 1798 Tell me the area(计算几何,求相交圆面积)
- Tell me the area(计算几何--求两圆相交面积)
- hdu 4946 Area of Mushroom 计算几何(凸包)
- HDU 4946 - Area of Mushroom (计算几何 凸包)
- poj1654 Area (计算几何)
- poj1265 Area(计算几何)
- [POJ1654]Area(计算几何)
- [POJ1265]Area(计算几何)
- hdu 4946 Area of Mushroom 计算几何
- hdu 1071 The area
- (hdu 1071)The area
- hdu 1071 The area
- hdu 1071 The Area
- HDU 1071 The area
- NGUI_2.6.3_(3D视图&ScrollView)
- cc、gcc、g++、CC的区别概括
- SDUT-3302-效率至上-RMQ||线段树
- Java中实现CallBack功能
- ZOJ3810--A Volcanic Island(四色定理模板)
- HDU 1071 The area(计算几何)
- 一位数据挖掘小伙的个人管理工具(不断优化中)
- 对人类社会的认识2
- Linux新手入门:Unable to locate package错误解决办法
- uvalive5990(坑点蛮多的一道题。。)
- 4.solrj对索引的增删改查
- 常用排序算法总结---Java实现
- Leetcode: Palindrome Linked List
- pickView的菜单选择代码