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 ...
随机推荐
- Linux下查看80端口是否被占用
方式一: ps -ef |grep 80 方式二: netstat -anp |grep :80 方式三: lsof -i:80 方式四: netstat -tunlp |grep :80 方式五: ...
- Pytorch学习笔记
非线性回归问题的参数求解,反向求导基本流程.Variable 计算时, 它在后台一步步默默地搭建着一个庞大的系统, 叫做计算图, computational graph. 这个图将所有的计算步骤 (节 ...
- [arc066f]Contest with Drinks Hard
题目大意: 有一些物品,每个买了有代价. 如果存在一个极大区间[l,r]内的物品都被买了,这个区间长度为k,可以获得的收益是k*(k+1)/2. 现在若干次询问,每次问假如修改了某个物品的价格,最大收 ...
- C语言之冒泡排序、选择排序、折半查询、进制查表
菜单导航 1.冒泡排序 2.选择排序 3.折半查询 4.进制查表(十进制转二进制.八进制.十六进制) 一.冒泡排序 //1.冒泡排序 /** 一组无序数字,进行从小到大排序 冒泡排序的过程:就是每个循 ...
- C语言整理——文件系统和文件访问
标准C中规定了文件系统的访问和对文件本身的访问.不管是windows系统或者是泛unix系统,都实现了这些接口.在了解这些知识后,跨平台编程也将非常容易. 对文件系统的访问接口有: chdrive() ...
- python 将列表(也可以是file.readlines())输出多个文件
open_diff = open('yanggao.txt', 'r',encoding='utf-8')diff_line = open_diff.readlines() diff_match_sp ...
- Fiddler教程--简介
1.开发环境host配置 自己修改系统的host来回挺麻烦的 2.前后的接口调试 3.线上bugfix 4.性能分析和优化 5.等等... 工作原理 一个代理服务器 地址改为 127.0.0.1:88 ...
- IDEA控制台问题:At least one JAR was scanned for TLDs yet contained no TLD
参考连接: https://www.cnblogs.com/interdrp/p/7763040.html 1.调整Tomcat对应类的log级别 2.观察Tomcat日志打印信息 3.调整${tom ...
- Oozie
Oozie的功能模块 workflow 由多个工作单元组成 工作单元之间有依赖关系 MR1->MR2->MR3->result hadoop jar:提交1个MR oozie:监控当 ...
- day9文件操作---从即日起时景丽阳老师给我们讲课
今天的主要内容是文件的操作,读,写,只读只写,或者可读同时可写,追加写,以二进制的方式读,以二进制的方式写,以二进制的方式追加. 思维导图: 给你一个文件路径,从中找出所有的文件,方法如下: # 方法 ...