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. Python— 匿名函数

    匿名函数 匿名函数:为了解决那些功能很简单的需求而设计的  “一句话函数” #初始代码 def calc(n): return n**n print(calc(10)) #换成匿名函数 calc = ...

  2. Hadoop createSnapshot和deleteSnapshot命令

    概述 HDFS快照是文件系统的只读时间点副本. 可以对文件系统的子树或整个文件系统进行快照. 快照的一些常见用例是数据备份,防止用户错误和灾难恢复.HDFS快照的实现是高效的: 快照创建是即时的:成本 ...

  3. 20170523 BSEG替代付款条件-ZTERM 天数-ZBD1T

    增强方式:替代,[替代基本用在FICO模块]BTE增强方式应用更广,需要学习总结. 程序:ZRGGBS* 步骤 1,SE16N:GB01 将 ZBD1T排除标记置为空,[注意,此更改跨client,d ...

  4. sql备份命令

    --将SQL脚本赋值给变量 ) set @SqlBackupDataBase=N'BACKUP DATABASE dbname TO DISK = ''E:\DBBackup\dbname-'+ ), ...

  5. Shell 条件判断总结

    -b file 若文件存在且是一个块特殊文件,则为真 -c file 若文件存在且是一个字符特殊文件,则为真 -d file 若文件存在且是一个目录,则为真 -e file 若文件存在,则为真 -f ...

  6. @MarkFan 口语练习录音 20140423 [风雨哈佛路.Homeless To Harvard口语录音]

    世界在转动,你只是一粒尘埃 没有你,世界照样在转 现实不会按照你的意识去改变的 一些人的需求 一些人的意志要比你更强 严酷的生活会让人不知所措 所以他们久久地困在挫败中 我们生气地抱怨,而对整体的形势 ...

  7. Zabbix3.0安装与部署(centos7)

    注:整理至http://blog.51cto.com/afterdawn/1923359 1 需要先搭建LAMP环境 http://www.cnblogs.com/cation/p/8882910.h ...

  8. Android系统--灯光系统驱动编写

    Android系统开发--Android灯光系统tiny4412_led_class驱动编写 框架分析 led_classdev_4412结构体 创建led_classdev_4412结构体 分配结构 ...

  9. Kubernetes addon-manager

    Addon-manager 附加组件管理器(Addon-manager)是运行在 Kubernetes 集群 Master 节点.用来管理附加组件(Addons)的服务.它管理着 $ADDON_PAT ...

  10. python 操作mongoDB数据库

    网上关于python 操作mongoDB的相关文章相对不是很多,并且质量也不是很高!下面给出一个完整的 增删改查示例程序! #!/usr/bin/python # -*- coding: utf-8 ...