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

GT and numbers

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2965    Accepted Submission(s): 737


Problem Description
You are given two numbers $N$ and $M$.

Every step you can get a new $N$ in the way that multiply $N$ by a factor of $N$.

Work out how many steps can $N$ be equal to $M$ at least.

If N can't be to M forever,print $-1$.
 

Input
In the first line there is a number $T$.$T$ is the test number.

In the next $T$ lines there are two numbers $N$ and $M$.

$T\leq1000$, $1\leq N \leq 1000000$,$1 \leq M \leq 2^{63}$.

Be careful to the range of M.

You'd better print the enter in the last line when you hack others.

You'd better not print space in the last of each line when you hack others.
 

Output
For each test case,output an answer.
 

Sample Input
3 1 1 1 2 2 4
 

Sample Output
0 -1 1
 

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-02 10:04:20, Gzip enabled