oval-and-rectangle
oval-and-rectangle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
The half of longer axes is on the x-axis with length $a$.
The half of shorter axes is on the y-axis with length $b$.
Patrick Star plan to choose a real number $c$ randomly from $[0, b]$, after that, Patrick Star will get a rectangle :
1. The four vertexes of it are on the outline of the oval.
2. The two sides of it parallel to coordinate axis.
3. One of its side is $y = c$.
Patrick Star want to know the expectations of the rectangle's perimeter.
Each line contains contains two integer a, b ($0 < b < a < 10^5$). Separated by an white space.
You should keep exactly 6 decimal digits and ignore the remain decimal digits.
It is guaranted that the 7-th decimal digit of answer wont be 0 or 9.
2 1
分析:椭圆性质有:
将y=c带入,求出内接矩形的周长,通过积分求出答案。
ac代码:
#include <iostream>
#include <cstdio>
using namespace std; int main()
{
int t;
cin>>t;
while(t--)
{
int a, b;
int x, y;
cin>>a>>b>>x>>y;
int w = b * (-) * x / a;
printf("%d\n", x/(w-y));
}
return ;
}
oval-and-rectangle的更多相关文章
- Android之shape属性详解
有时候 ,为了满足一些需求,我们要用到 shape 去定义 一些背景,shape 的用法 跟图片一样 ,可以给View设置 Android:background="@drawable/sha ...
- 【Android 界面效果20】Android GradientDrawable类的详解,设置activity的背景颜色渐变效果
看到这个例子的标题RoundRects,我的第一感觉是介绍RoundRectShape, 打开例子看了代码却是使用GradientDrawable来实现的. GradientDrawable 支持使用 ...
- Android GradientDrawable类的详解,设置activity的背景颜色渐变效果
看到这个例子的标题RoundRects,我的第一感觉是介绍RoundRectShape, 打开例子看了代码却是使用GradientDrawable来实现的. GradientDrawable 支持使用 ...
- Android电子书翻页效果实现
这篇文章是在参考了别人的博客基础上,修改了其中一个翻页bug,并且加了详细注释 先看效果 其中使用了贝赛尔曲线原理,关于贝赛尔曲线的知识,推荐大家看下http://blog.csdn.net/hmg2 ...
- Python Tkinter学习笔记
介绍 入门实例 显示一个窗口,窗口里面有一个标签,显示文字 import tkinter as tk # 一个顶层窗口的实例(Top Level),也称为根窗口 app = tk.Tk() # 设置窗 ...
- Python Tkinter canvas oval原理
Ovals, mathematically, are ellipses, including circles as a special case. The ellipse is fit into a ...
- [LeetCode] Perfect Rectangle 完美矩形
Given N axis-aligned rectangles where N > 0, determine if they all together form an exact cover o ...
- [LeetCode] Max Sum of Rectangle No Larger Than K 最大矩阵和不超过K
Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix s ...
- [LeetCode] Smallest Rectangle Enclosing Black Pixels 包含黑像素的最小矩阵
An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black ...
- [LeetCode] Rectangle Area 矩形面积
Find the total area covered by two rectilinear rectangles in a2D plane. Each rectangle is defined by ...
随机推荐
- 免费API接口
网址:https://code.juhe.cn/ http://apistore.baidu.com/ http://blog.csdn.net/cc20032706/article/details/ ...
- ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN DESC)函数的使用
ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN DESC)函数的作用是指定COLUMN(列)进行分区,在分区内指定COLUMN(列)进行排序 ...
- net-snmp 安装与trap调试
https://sourceforge.net/projects/net-snmp/files/net-snmp/5.7.3/
- delphi使用sqlite数据库时的中文路径问题
https://blog.csdn.net/yuehaiyang/article/details/4184198 如果数据库所在的路径是中文路径的话,根本运行不起来,会报错,因为sqlite用的是ut ...
- ubuntu多版本cuda并存与切换【两个博客链接】
https://bluesmilery.github.io/blogs/a687003b/ https://blog.csdn.net/Maple2014/article/details/785742 ...
- CentOS6— Redis安装(转和延续)
Part I. Redis安装(转载部分) 一.安装(官网地址 http://redis.io/download) wget http://download.redis.io/redis-stable ...
- ANGULAR6.x - 错误随笔 - Can't bind to 'formGroup'
formGroup:错误 Can't bind to 'formGroup' since it isn't a known property of 'form'. (" 原因: 在使用for ...
- 去掉select的原有样式
1:设置select的边框为0px,背景设成透明(background: transparent;),这时候你会看到边框没有了,但是小三角还是在的.再在select外面加个div,固定死div的宽度, ...
- Linux 配置最新的epel源
一.Centos6 yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm 二.Cento ...
- Nginx反向代理的基本配置
(1)proxy_pass 语法:proxy_pass URL; 配置块:location.if 此配置项将当前请求反向代理到URL参数指定的服务器上,URL可以是主机名或IP地址加端口的形式,例如: ...