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 ...
随机推荐
- webpack学习笔记--其它配置项
其它配置项 除了前面介绍到的配置项外,Webpack 还提供了一些零散的配置项.下面来介绍它们中常用的部分. Target JavaScript 的应用场景越来越多,从浏览器到 Node.js,这些 ...
- golang 请求带验证信息的坑
最近用golang 和python对接接口,由于之前验证那块没有设置好,然后又为了进度,最近决定用http自带的basic 验证, php的代码很快就验证通过了 /** * @param $url * ...
- H5利用pattern属性和oninvalid属性验证表单
HTML代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <ti ...
- Genius ACM
题解: 发现匹配一定会选最大和最小匹配,确定左右端点之后nlogn排序后算 比较容易想到二分 最坏情况每次1个 $n^2*(logn)^2$ 没错暴力的最差复杂度是$n^2*logn$的 发现长度与次 ...
- ubuntud安装Adobe Flash Player / Plugin
1.https://get.adobe.com/flashplayer/ , select tar.gz for other Linux, download 2.Unpack the tar.gz f ...
- ubuntu12.04 mysql 卸载安装
参考: https://blog.csdn.net/qq_26093511/article/details/52847943
- 求小于n且与n互质的数的个数
int eu(int n){ int ans=n; for(int i=2;i*i<=n;i++) { if(n%i==0) { ans=ans/i*(i-1); while(n%i==0)n/ ...
- IDEA设置
一:代码提示 二:自动导入
- Lock为线程上锁,防止数据混乱
用法: 先实例化 lock = threading.Lock() 1. lock.acquire() 上锁 需上锁代码 lock.release() 解锁 2. with lock: 上下两种方式都 ...
- P2280 [HNOI2003]激光炸弹(二维前缀和)
题目描述 一种新型的激光炸弹,可以摧毁一个边长为R的正方形内的所有的目标.现在地图上有n(n≤10000)个目标,用整数xi,yi(0≤xi,yi≤5000)表示目标在地图上的位置,每个目标都有一个价 ...