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. android自定义View (五)view.requestLayout() 与 invalidate()

    一.要点 If in the course of processing the event, the view's bounds may need to be changed, the view wi ...

  2. (4.16)sql server迁移DB文件(同一DB内)

    SQL Server 修改数据库物理文件存在位置 关键词:迁移文件,迁移temp库(这怎么迁移呢,用方法2即可,需要重启实例) 三种均需要离线: 一共分为(1)脱机迁移和(2)在线迁移. (1)迁移方 ...

  3. Python基础-os和sys模块

    os模块提供对操作系统进行调用的接口 import os os.getcwd() # 获取当前工作目录 os.chdir(r'd:\fansik') # 修改对当前工作目录 print(os.curd ...

  4. LeetCode-11-6

    1.  Two Sum Given an array of integers, return indices of the two numbers such that they add up to a ...

  5. Python 1 数据类型的操作

    一.数字(Number) 1.数学函数: 函数 返回值 ( 描述 ) abs(x) 返回数字的绝对值,如abs(-10) 返回 10 ceil(x) 返回数字的上入整数,如math.ceil(4.1) ...

  6. PHP日期与时间戳转换

    设置时区 在php.ini中找到data.timezone去掉它前面的;号,然后设置data.timezone = "Asia/Shanghai"; 或者 ini_set('dat ...

  7. ThinkPHP框架基础知识一

    ThinkPHP是一个快速.兼容而且简单的轻量级国产PHP开发框架,诞生于2006年初,原名FCS,2007年元旦正式更名为ThinkPHP,遵循Apache2开源协议发布,从Struts结构移植过来 ...

  8. 每天一个Linux命令(48)ping命令

        ping命令用来测试主机之间网络的连通性.     (1)用法:     用法:  ping [参数] [主机名或IP地址]     (2)功能:     功能:  确定网络和各外部主机的状态 ...

  9. comet4j开发指南

    http://blog.csdn.net/majian_1987/article/details/8489738 好多朋友反映,因排版问题,文章部分边缘内容无法查看.尝试过排版,但仍无法显示正常,所以 ...

  10. 【Head First Servlets and JSP】笔记9:属性的作用域、线程安全

    什么是属性? 属性和参数 属性的3个作用域 属性API 属性不好的一面 1.到底什么是属性(Attribute)? 属性就是一个对象,可以被设置(bound,也可以叫绑定)到另外三个servlet A ...