RedField

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 639    Accepted Submission(s): 213

Problem Description
As the graph you see below, we named the red part "RedField".The read
part is the intersection of an ellipse and a triangle.Now, 8600's not
good at math, so he wants you to help him calculate the area of the
"RedField".
 
Input
The first line of input contains n, the number of test cases. n lines
follow.Each test case contains four numbers a, b, x, y(0 < b <= a
<= x),and a is the lenth of OA, b is the lenth of OB,and x, y
representing the coordinate of the point P.
 
Output
For each test case, output the area of the "RedField",accurate up to 2 decimal places.
 
Sample Input
1
1.00 1.00 2.00 2.00
 
Sample Output
0.39
 
Source
 
Recommend
lcy
非常简单的高数题!
1.先求出交点!
2.再对交点右边的含有抛物线的部分积分,再加上三角形就好了!
有一个要注意的地方:就是y可以为负数,即p可以在x轴的下方。(这里我WA了3次,哎真的没有仔细考虑啊!!)

    1. #include<iostream>
    2. #include<cstdio>
    3. #include<cmath>
    4. using namespace std;
    5. int main()
    6. {
    7. int n;
    8. cin>>n;
    9. while(n--)
    10. {
    11. double A,B,k,j_x,j_y,ans;
    12. double p_x,p_y;
    13. cin>>A>>B>>p_x>>p_y;
    14. p_y = p_y>0?p_y:-p_y;
    15. k=p_y/p_x;
    16. double tt=(A*A*B*B)/(B*B+A*A*k*k);
    17. j_x=sqrt(tt);
    18. j_y=k*j_x;
    19. double t1=asin(1.0);
    20. double t2=asin(j_x/A);
    21. ans=A*B*(  ( t1+sin(2*t1)/2.0) -(t2+sin(2*t2)/2.0) )/2+j_x*j_y/2;
    22. printf("%.2lf\n",ans);
    23. }
    24. return 0;
    25. }

hdu 1714 RedField的更多相关文章

  1. HDU 1714 math

    #include<stdio.h>#include<string.h>#include<iostream>#include<iomanip>#inclu ...

  2. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  3. HDU 1710 二叉树的遍历 Binary Tree Traversals

    Binary Tree Traversals Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

  4. HDU 1708 简单dp问题 Fibonacci String

    Fibonacci String Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  6. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  7. poj和hdu部分基础算法分类及难度排序

    最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...

  8. hdu 1708 Fibonacci String

    Fibonacci String Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...

  9. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

随机推荐

  1. BIO与NIO

    BIO与NIO 1.传统BIO (1)特点 面向数据流 阻塞式传输 一个客户端对应一个线程 在客户机增多的情况下,线程资源随之增多,会造成cpu资源枯竭 (2)需求 ​ 客户机向服务器输出字符串,逐一 ...

  2. 网页弹出[Object HTMLDivElement],怎么取值?

    使用innerHTML方法,可以得到文本值

  3. 6-1 md5加密

    1.导入hashlib模块,使用它的md5方法进行加密 import hashlib # import md5 python2 s = 'admin123' # .将字符串类型转换成byte类型才能加 ...

  4. thinkphp5,单图,多图,上传

    /** * 上传单图 */ function upload($path, $filename) { $file = request()->file($filename); $info = $fi ...

  5. Python中的文件和目录操作实现

    Python中的文件和目录操作实现 对于文件和目录的处理,虽然可以通过操作系统命令来完成,但是Python语言为了便于开发人员以编程的方式处理相关工作,提供了许多处理文件和目录的内置函数.重要的是,这 ...

  6. JS常用数组方法及实例

    1.join(separator):将数组的元素组起一个字符串,以separator为分隔符 ,,,,]; var b = a.join("|"); //如果不用分隔符,默认逗号隔 ...

  7. SpringCloud框架搭建+实际例子+讲解+系列五

    (4)服务消费者,面向前端或者用户的服务 本模块涉及到很多知识点:比如Swagger的应用,SpringCloud断路器的使用,服务API的检查.token的校验,feign消费者的使用.大致代码框架 ...

  8. linux最大进程数

    使用 ulimit -a 命令,查看 max user processes 的输出,就是系统最大进程数 core file size (blocks, -c) unlimited data seg s ...

  9. POJ:1703-Find them, Catch them(并查集好题)(种类并查集)

    Find them, Catch them Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 49867 Accepted: 153 ...

  10. 9,Flask 中的蓝图(BluePrint)

    蓝图,听起来就是一个很宏伟的东西,在Flask中的蓝图 blueprint 也是非常宏伟的,它的作用就是将 功能 与 主服务 分开. 比如说,你有一个客户管理系统,最开始的时候,只有一个查看客户列表的 ...