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. Sass 语法格式及编译

    一.sass语法格式 这里说的 Sass 语法是 Sass 的最初语法格式,他是通过 tab 键控制缩进的一种语法规则,而且这种缩进要求非常严格.另外其不带有任何的分号和大括号.常常把这种格式称为 S ...

  2. 3、SpringBoot+MybatisPlus整合-------代码生成器

    <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</art ...

  3. linux服务器安装nginx及使用

    Nginx在个人的使用之后,感觉非常的方便,所以在这里给出自己安装配置方案.它是一款高性能的 Web和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器.负载均衡是个不错的选择. ...

  4. SpringBoot学习13:springboot异常处理方式3(使用@ControllerAdvice+@ExceptionHandle注解)

    问题:使用@ExceptionHandle注解需要在每一个controller代码里面都添加异常处理,会咋成代码冗余 解决方法:新建一个全局异常处理类,添加@ControllerAdvice注解即可 ...

  5. hadoop-2.0.0-cdh4.1.2升级到hadoop-2.7.2

    升级前准备: 如果是 centos6.x的系统得升级glibc和pam包 在/etc/ld.so.conf 文件里添加 /usr/src/jdk1.6.0_23/jre/lib/amd64/serve ...

  6. python基础回顾笔记

    1.知道了什么是编程语言 2.知道了python.C#.Java都是语言的种类 3.python:有很多种 cpython.pypy.jpython... 4.python的执行方式有两种: 解释器 ...

  7. 精读《12 个评估 JS 库你需要关心的事》

    1 引言 作者给出了从 12 个角度全面分析 JS 库的可用性,分别是: 特性. 稳定性. 性能. 包生态. 社区. 学习曲线. 文档. 工具. 发展历史. 团队. 兼容性. 趋势. 下面总结一下作者 ...

  8. 如果文件里是汉字的话,这地方seek括号里面只能是偶数

    >>> f=open("E:/pythonLearn/140.txt") >>> f.seek(8) #如果文件里是汉字的话,这地方seek括号 ...

  9. POJ:2385-Apple Catching(dp经典题)

    Apple Catching Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14311 Accepted: 7000 Descr ...

  10. scala高级性质-隐式转换 -02

    今天我们来介绍scala的高级特性,上次已经介绍过他的一个特性:高阶函数,这次是隐式转换 1.隐式转换的例子 read的例子 解析:发现这个file没有read的方法,然后就开始在开始在这个上下文里面 ...