1204: Escape from the Darkness

Time Limit: 1 Sec  Memory Limit: 1280 MB
Submit: 93  Solved: 3
[Submit][Status][Web Board]

Description

Xiao Ming, a high school student, learnt blackbody radiation from the physics class. The black body on the book is indicated approximately by black body cavity as below:

from the small hole if total reflection occurs on the surface of the cavity.

Assuming in the two-dimensional coordinates, the center of the oval is at origin, and the vertexes of it is respectively (a, 0), (-a, 0), (0, b), (0, -b). There is a small hole at (a/2,sqrt(3)*b/2) (whose areas can be ignored). A beam of light (whose diameter can be ignored) shoot into the oval through the small hole. The direction of the light is (-1, 0). Assuming the light totally mirror reflects on the surface of the oval, the question is how many times can the light reflect before shooting out through the small hole. (If a point is away from the small hole less than 0.01, we think light shoot out from that point.)

Input

The first line is a positive integer T (1 <= T <= 55) which indicates the numbers of the test cases. Then flowing next T lines, there are two positive integer a, b (1 <= b<= a<= 10) in each line as a group of cases.

Output

The output of each case is one line with a positive integer which indicates the times of reflects.

Sample Input

1
1 1

Sample Output

5

HINT

The path of the light in the sample is looked as the picture shows. The light reflected five times.

Source

hzau 1204 Escape from the Darkness的更多相关文章

  1. ACM: Gym 101047E Escape from Ayutthaya - BFS

    Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I6 ...

  2. 简单明了区分escape、encodeURI和encodeURIComponent

    一.前言 讲这3个方法区别的文章太多了,但是大部分写的都很绕.本文试图从实践角度去讲这3个方法. 二.escape和它们不是同一类 简单来说,escape是对字符串(string)进行编码(而另外两种 ...

  3. c#模拟js escape方法

    public static string Escape(string s) { StringBuilder sb = new StringBuilder(); byte[] ba = System.T ...

  4. 【BZOJ-1340】Escape逃跑问题 最小割

    1340: [Baltic2007]Escape逃跑问题 Time Limit: 5 Sec  Memory Limit: 162 MBSubmit: 264  Solved: 121[Submit] ...

  5. LYDSY热身赛 escape

    Description 给出数字N(1<=N<=10000),X(1<=x<=1000),Y(1<=Y<=1000),代表有N个敌人分布一个X行Y列的矩阵上矩形的行 ...

  6. javascript escape()函数和unescape()函数

    javascript escape()函数和unescape()函数 escape() 函数可对字符串进行编码,这样就可以在所有的计算机上读取该字符串. 语法: escape(string) stri ...

  7. HDU 3605 Escape(状压+最大流)

    Escape Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Sub ...

  8. escape,encodeURI,encodeURIComponent的区别

    escape是对字符串进行编码而另外两种是对URL. encodeURI方法不会对下列字符编码 ASCII字母 数字 ~!@#$&*()=:/,;?+'encodeURIComponent方法 ...

  9. C#针对js escape解码

    在javascript 中通常用escape与unescape进行编码以方便传输. 在asp.net页面接收到这些数据以后可以使用 Microsoft.JScript.GlobalObject.une ...

随机推荐

  1. 涉及到复制和二进制日志中的选项和变量-Replication and Binary Logging Options and Variables

    在搭建复制中,有些参数需要我们留意,在这里罗列出来,供大家参考一下,以GTID为基础 --server-id server-id:这是一个全局的可动态调整的变量,取值范围为0-4294967295,也 ...

  2. vb.net 正則表達式 取 固定格式的字符

    vb.net 正則表達式 取 固定格式的字符: 原始字符串:strSqlTmp="select * from A_TEST where a_data = '@1@' and b_link = ...

  3. ios 避免两个button同一时候被点击

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/superchaoxian/article/details/24631293 这个能够通过[btn   ...

  4. 《Python 机器学习》笔记(四)

    数据预处理--构建好的训练数据集 机器学习算法最终学习结果的优劣取决于两个主要因素:数据的质量和数据中蕴含的有用信息的数量. 缺失数据的处理 在实际应用过程中,样本由于各种原因缺少一个或多个值得情况并 ...

  5. C# emoji 表情如何插入mssql

    如何将emoji表情存入mssql 呢? 在Windows显示emoji(win7需要安装补丁) 在MAC完美支持 步骤就是将显示不出来的emoji UrlEncode=>进入MSsql 然后拿 ...

  6. JAVA中遍历Map和Set方法,取出map中所有的key

    Java遍历Set集合 1.迭代器遍历: Set<String> set = new HashSet<String>(); Iterator<String> it ...

  7. Bootstrap入门教程

    资料来源: http://www.cnblogs.com/ventlam/archive/2012/05/28/2520703.html 1.全局样式:Bootstrap要求html5的文件类型,所以 ...

  8. PHP......会话控制SESSION与COOKIE

    一.SESSION Session:在计算机中,尤其是在网络应用中,称为“会话控制”.Session 对象存储特定用户会话所需的属性及配置信息.这样,当用户在应用程序的 Web 页之间跳转时,存储在 ...

  9. octotree神器 For Github and GitLab 火狐插件

    Code tree for GitHub and GitLabExtension to show code tree for GitHub and GitLab. Useful for develop ...

  10. 树莓派使用DHT11温湿度传感器(C语言程序)

    pi4j是基于wiringpi开发的通过java来控制树莓派GPIO口的库文件.在java程序中引入相关类就可以使用已经封装好的方法控制树莓派GPIO口. pi4j官网:http://pi4j.com ...