F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Cow`s Segment

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 496    Accepted Submission(s): 26


Problem Description
Farmer John is playing math game with cows. To help his cows learning addition and multiplication, he invented a new game. In the beginning, he would provide two number $a$ and $b$. After that, cows would report two number each turn. At the turn $i$, $i\times a$ and $i \times b$ should be reported. Once there exists an integer in the segment $[i \times a, i \times b]$, the game ends. Now, John wants to know after how many turns the game would end. So, he ask for your help.
 

Input
The first line is the number of test cases. For each test case, there are two non-negative float-point numbers $a$ and $b$. The precision of these numbers are less than $300$ decimal places. It is guaranteed that $a < b$.
 

Output
For each test case, output an integer $n$ donating that the game will end in $n$ turns.
 

Sample Input
1 1.2 1.3
 

Sample Output
4
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-19 06:43:16, Gzip enabled