hdu 1071 - The area

Hdu1071 The area Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7841    Accepted Submission(s): 5510 Problem Description Ignatius bought a land last 阅读详情


The area

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 6004    Accepted Submission(s): 4193


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
Hint
For float may be not accurate enough, please use double instead of float.



====================================


直线方程:y=kx+b

抛物线方程:一般式:y=ax^2+bx+c

                        顶点式:y=a(x-h)^2+c

两方程相减做积分


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int t;double x0,x1,x2,y0,y1,y2,k,b,h,c,a,s;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lf%lf%lf%lf%lf%lf",&x0,&y0,&x1,&y1,&x2,&y2);
        k=(y2-y1)/(x2-x1);
        b=y1-k*x1;
        h=x0;
        c=y0;
        a=(y1-c)/((x1-h)*(x1-h));
        s=a/3*((x2-h)*(x2-h)*(x2-h)-(x1-h)*(x1-h)*(x1-h))+c*(x2-x1)-k/2*(x2*x2-x1*x1)-b*(x2-x1);
        printf("%.2lf\n",s);
    }
    return 0;
}


自适应粒子群优化(Adaptive Particle Swarm Optimization,APSO 下面是一个关于自适应粒子群优化(Adaptive Particle Swarm Optimization,APSO)的博客,希望可以帮助您。提示:以下是本篇文章正文内容,下面案例可供参考在上面的代码中,表示粒子的数量,表示解空间的维度,表示迭代次数,表示优化的目标函数。在__init__方法中,我们初始化了粒子群的位置和速度,并将每个粒子的位置作为其最优解,将其适应度值初始化为正无穷。我们还初始化了学习因子和惯性权重的参数。在run方法中,我们迭代了次,计算每个粒子的适应度值和最优解。 阅读详情

相关推荐

芯片详解——AD7606

AD7606详解

weixin_45661757的博客 5021

hdu1071

#include #include using namespace std; struct point  { double x,y; }po[3]; double find_a(double x,double y,double x0,double y0) { return (y-y0)/((x-x0)*(x-x0)); } double find_b(double x1,do

linxingqianglai的专栏 430

阿里云导出的镜像raw转换成vmdk格式工具

阿里云导出的镜像raw转换成vmdk格式工具 1.安装java环境,安装教程不介绍了 2.raw2vmdk软件下载: 在我的链接里面: 3.使用 打开cmd.bat软件: java -jar raw2vmdk.jar (原镜像)C:\\images\\raw\\disk.img (转换的镜像)D:\\images\\vmdk\\disk.vmdk 4.vmware打开vmdk文件 ...

3843

HDU 1071 The area 数学题

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1071 用抛物线的顶点公式y=a(x-x1)^2+y1外加另一个点x2算出a,再求出直线方程,之后求定积分。 代码如下: #include #include #include #include #include #include #include #include

lamborghini1993 1501

一文告诉你:如何在trae中编译运行STM32程序,并让AI帮你修改代码

本文详细介绍了如何将STM32程序从Keil迁移到国产免费工具Trae,并利用AI进行代码修改的全过程。

水滴爬呀爬 4886

【Matlab】如何使用Simulink进行电池建模和SOC预估

“通过Simulink电池建模进行SOC预估,其实挺容易!” 1 声明 本文只描述一般性电池建模方法,文中出现的电池相关数据来自一些论文或者外文文献,对数据的真实性不做任何保证。 本文参考了不少国内高校的硕士论文和外文文献,所以本篇文章只作为学术性交流,未经...

wanff1204的博客 2万+

HDU 1071 The area 详解

The area 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 al

shangyuexi的博客 578

一分钟理解 “熔断“, “限流“ 与 “降级“

熔断,本质是一种“故障隔离”机制,用于当某个依赖服务出现持续故障(如响应超时、错误率飙升)时,暂时切断对该服务的调用,避免故障扩散到整个系统,防止“雪崩效应”;待依赖服务恢复正常后,再逐步恢复调用。其核心逻辑参考了现实中的“电路保险丝”——电路过载时,保险丝熔断,切断电路,保护电器不被烧毁;故障排除后,更换保险丝,电路恢复正常。闭合状态(Closed):正常状态,请求可以正常调用依赖服务,同时监控调用的错误率、超时率等指标。打开状态(Open)

h a 6 6 6 c k 为 你解决复杂难题! 1469

hdu 1071 The area

http://acm.hdu.edu.cn/showproblem.php?pid=1071/* 2011-9-9 author:BearFly1990 */ package acm.hdu.tests; import java.io.BufferedInputStream;

476

【学习系列】SAP RAP 2:创建第一个RAP应用

本文介绍了从零开始创建基于SAP RAP(ABAP RESTful Application Programming Model)的Fiori应用的完整流程。首先说明了学习RAP需要结合官方文档和教程,并提供了相关资源链接。文章详细讲解了开发环境的准备要求,包括系统版本、开发工具和基本知识。重点演示了如何通过8个步骤创建支持CRUD操作和草稿功能的RAP应用:1)创建数据库表;2)定义CDS视图实体;3)创建投影视图;4)定义行为;5)创建行为投影;6)定义服务;7)绑定服务;8)添加UI注解。

DeveloperMrMeng的博客 1498

【人工智能】RAG如何根据实际需求选择和进行文档解析(如 PDF、Word、TXT、网页等)?

文档解析的核心在于根据解析目标、文档类型和处理量选择合适工具。PDF、Word、TXT和网页各有特性:PDF需区分可编辑与扫描版,Word需处理结构化内容,TXT简单但需注意编码,网页需应对动态内容。解析场景包括提取纯文本、结构化数据、保留格式和批量处理。非技术用户可借助工具如Adobe Acrobat、WPS和在线OCR,技术用户可通过编程实现自动化。通用流程为:明确目标、分析文档属性、选择工具并测试优化。核心是“工具适配需求”,无需追求万能方案。

奶爸的编程之路,也就一周冷个三天 506

The area (HDU 1071)

Problem - 1071 Online Judge Online Exercise Online Teaching Online Contests Exercise Author F.A.Q Hand In Hand Online Acmers Forum | Discuss S

剑洋侠客 1024

安装 miniconda linux

安装 miniconda linux

jacke121的专栏 1万+

HDU1071——The area,HDU1072——Nightmare,HDU1073——Online Judge

比较去除特殊字符后的两个字符串,如果不同输出 "Wrong Answer" ,否则输出 "Presentation Error"。通过 BFS 逐层扩展搜索,根据地图中的元素和时间规则,找到从起点到终点的最短时间路径。这段代码主要实现了一个使用广度优先搜索(BFS)算法来解决一个在特定地图上的时间相关的路径搜索问题。数组记录每个位置的最优时间,避免重复访问和无效搜索,最终找到满足条件的最短时间。,说明结果是已接受的,输出 "Accepted"。函数读取输入,将有效的行分别添加到对应的。

u014114223的博客 1210

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

HDU 1071 The area

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1071 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 an...

aisebu7819的博客 149

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

HDU1071 The area

The area Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9349    Accepted Submission(s): 6591 Problem Description Ignatius bought a lan

KeyboardPianist的博客 579

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

HDU 1071 The area 定积分

The area Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5819    Accepted Submission(s): 4063 Problem Description Ignatius bought a

Sheldon的博客 486

HDU1071 The area 【积分】

The area Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7476    Accepted Submission(s): 5222 Problem Description Ignatius bought a

长风的专栏 1137

HDU OJ 1071: The area

HDU OJ 1071: The area序言: 刚自学了一个月的算法,算个小萌新吧(其实实在菜的一匹…)。考虑到很多知识点容易遗忘,就准备写些东西来记录一下学习过程。第一次写博客,今天先写个简单的练练手。Problem Description: Ignatius bought a land last week, but he didn’t know the area of the la

ajaxlt的博客 411

hdu 1071 The Area

题目:http://acm.hdu.edu.cn/showproblem.php?pid=1071   ‍ 抛物线表达式为y= a(x-x1)^2+y1; 直线表达式为y=kx+b; 面积可通过积分来计算a(x-x1)^2+y1 -(kx+b) 下面是AC代码: #include #include double x,y,x2,y2,x3,y3; double

727

hdu 1071 The area

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 intersecta

---小菜鸟--- 273

HDU 1071 - The area

HDU 1020 - The area Easy Math Problems -_- Output the area of the shadow area. The consuming key point exsists in how to caculate a, b, c. kind of easy, as long as you just go ahead without

Fisher_Collect的专栏 764

hdu1071 The area

The area 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

wchhlbt的博客 438

hdu-1071 The area

计算几何(定积分求面积) The area Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6614    Accepted Submission(s): 4633 Problem Description

Just do IT! 717
上一篇: hdu 1018 - Big Number
下一篇: hdu 1060 - Leftmost Digit(求N^N最高位)
coco430
博客等级 码龄14年 9粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值