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. 树状数组区间修改and查询和

    在差分数组上稍加改变,就可以实现这个骚操作 首先我们先来看一看普通的树状数组(基于差分)怎么暴力的求解区间和就是询问区间长度次和 \(\sum^{i=1}_{len}\sum^{j=1}_{i}bas ...

  2. Q&A - 如何获取ip地址所在地

    获取其IP地址后,传入以下URL,并请求该URL,该请求会响应一个JSON格式的数据包,该IP地址的所在地均在这个数据包内   http://int.dpool.sina.com.cn/iplooku ...

  3. PXE+DHCP+TFTP+Cobbler 无人值守安装centos 7

    Cobbler(补鞋匠)是通过将DHCP.TFTP.DNS.HTTP等服务进行集成,创建一个中央管理节点,其可以实现的功能有配置服务,创建存储库,解压缩操作系统媒介,代理或集成一个配置管理系统,控制电 ...

  4. 《算法》第四版 IDEA 运行环境的搭建

    <算法>第四版 IDEA 运行环境的搭建 新建 模板 小书匠 在搭建之初,我是想不到会出现如此之多的问题.我看了网上的大部分教程,都是基于Eclipse搭建的,还没有使用IDEA搭建的教程 ...

  5. Head First Java-图形化界面

    Head First Java是本挺好的书,讲的比较清楚和简单.主要看原则.概念啥的.语法什么的,还是靠谷歌吧:) 这部分的笔记也有很多了,最近会努力更新和搬运.顺便自己也重新读一下. 就酱.想要这本 ...

  6. MongoDB的Go语言驱动注意点

    当我们定义一个struct用来和集合对应时,要注意结构体的字段首字母应该大写,不然不可见. 通过`bson:"name"`这种方式可以定义MongoDB中集合的字段名,如果不定义, ...

  7. POJ:2976-Dropping tests(二分平均值)

    Dropping tests Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15508 Accepted: 5418 Descr ...

  8. ABAP News for Release 7.51 – ABAP CDS Client Handling

    Open SQLは自動的クライアント処理をサポートしています. Open SQLでクライアント依存のデータソースにアクセスする時.デフォルトでは現在のクライアントのデータだけが考慮されます. クライア ...

  9. HDFS HA 的 core-site.xml

    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Licens ...

  10. jquery跨域解决方案JSONP

    1.在互联网中我们的计算机是通过IP来定位的,但是IP比较难记忆,因此通过domain name(域名)来取代IP 2.什么是跨域? (1)默认浏览器为了安全问题,禁止了xmlhttprequest跨 ...