**Physical Address**

304 North Cardinal St.

Dorchester Center, MA 02124

Chef Two and Chef Ten are playing a game with a number *X*. In one turn, they can multiply *X* by 2. The goal of the game is to make *X* divisible by 10.

Help the Chefs find the smallest number of turns necessary to win the game (it may be possible to win in zero turns) or determine that it is impossible.

- The first line of the input contains a single integer
*T*denoting the number of test cases. The description of*T*test cases follows. - The first and only line of each test case contains a single integer denoting the initial value of
*X*.

For each test case, print a single line containing one integer — the minimum required number of turns or −1 if there is no way to win the game.

- 1≤
*T*≤1000 - 0≤
*X*≤10^9

**Subtask #1 (100 points):** original constraints

```
Input:
3
10
25
1
Output:
0
1
-1
```

```
# cook your dish here
for _ in range(int(input())):
x = int(input())
if x%10==0:
print(0)
elif x%10==5:
print(1)
else:
print(-1)
```

```
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner s = new Scanner(System.in);
int t = 0;
int x = 0;
t = s.nextInt();
for (int c = 0; c < t; c++)
{
x = s.nextInt();
if (x % 10 == 0)
{
System.out.println(0);
}
else if (x % 5 == 0)
{
System.out.println(1);
}
else
{
System.out.println(-1);
}
}
// your code goes here
}
}
```

```
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t; cin>>t;
while(t--){
long long int x; cin>>x;
if(x%10==0){
cout<<0<<endl;
}else if(x%5==0){
cout<<1<<endl;
}else{
cout<<-1<<endl;
}
}
return 0;
}
```

In our experience, we suggest you solve this Two vs Ten CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Two vs Ten CodeChef Solution

I hope this Two vs Ten CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

**More Coding Solutions >>**