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. React后端管理系统-商品详情detail组件

    import React from 'react'; import MUtil from 'util/mm.jsx' import Product from 'service/product-serv ...

  2. WEB相关背景知识(新手)

    1.评估域名类型 .com——商业实体 .edu——仅限有学位或更高等学历授予资格的高等教育使用 .gov——仅限政府使用 .net——与Internrt网络支持相关的团体,通常是Internet服务 ...

  3. Javascript入门笔记1-script标签

    1.script标签在HTML文件中添加JavaScript代码. JavaScript代码只能写在HTML文件中吗?当然不是,我们可以把HTML文件和JS代码分开,并单独创建一个JavaScript ...

  4. 开发常用宏 - iOS

    以下是一些开发中会经常用到的宏,简单的进行了整理,为了今后可以更加方便的使用,从而提升开发的效率,不为此搭进去更多时间. 也希望有大家可以补充,从而使其更加强加! /** * 开发常用宏相关 */ # ...

  5. HDU.2561 第二小整数(water)

    题目来源:2561 题意分析:找出一堆数中第二小的整数,和题目说的一样 我的思路:冒泡或者sort()一下就ok了,但是我因为没看到多个测试用例还是吃了几记WA . ┭┮﹏┭┮ 完整代码: #incl ...

  6. win7同时安装python2和python3

    1.下载python2和python3版本. 2.安装python3   1>选择添加PATH路径到系统.   2>为所有用户安装python. 3.安装python2   1>为所 ...

  7. 10.1.2 Document类型【JavaScript高级程序设计第三版】

    JavaScript 通过Document 类型表示文档.在浏览器中,document 对象是HTMLDocument(继承自Document 类型)的一个实例,表示整个HTML 页面.而且,docu ...

  8. Linux系统完整安装在虚拟机Mini

    打开VMware Workstation虚拟机,然后如下图一步到位: 此处只是简单的安装Linux系统,要想查看安装后的IP等配置看: https://www.cnblogs.com/gentle-a ...

  9. 学习python第十一天,函数3 函数的序列化和反序列化

    我们把变量从内存中变成可存储或传输的过程称之为序列化,序列化之后,就可以把序列化后的内容写入磁盘,或者通过网络传输到别的机器上. 反过来,把变量内容从序列化的对象重新读到内存里称之为反序列化,即unp ...

  10. 线程、进程、协程和GIL(一)

    参考链接:https://www.cnblogs.com/alex3714/articles/5230609.html https://www.cnblogs.com/work115/p/562027 ...