Submit | All submissions | Best solutions | Back to list |
STAN - Sentimental Stan |
For the Australian Open preparation, Stan Wawrinka is planning to move into a new practice court in Melbourne. For that, he should transfer all his tennis balls from the old court to the new one. He divides all his balls into a number of group(s) and will put each group of balls into a different bag. Stan is very sentimental(remember his pink-checkered shorts in French Open). So, he wants to make sure that the number of balls in each bag is not a prime number as he doesn't like prime numbers. He has bags which can accommodate any arbitrary number of balls. Please help him find the minimum number of bags which he needs to transfer all the balls.
Input
First line consists of number of test cases - T.
For each test case, there will be a single integer N denoting the number of balls.
Output
For each test case, print a single integer denoting the minimum number of bags. If it's not possible to divide the number as required, print -1.
Constraints:
1<=T<=100
1<=N<=10^12
Example
Input: 2 17 16 Output: 2 1
Explanation
In the first test case, 17 can be split into 2 groups in various ways one of which is (8,9).
In the second test case, 16 is not a prime and so he can put all the balls in the same bag.
Added by: | Noob |
Date: | 2015-11-28 |
Time limit: | 2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 MAWK BC NCSHARP COFFEE DART FORTH GOSU JS-MONKEY JULIA KTLN OCT PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA |
Public source code since: | 2015-11-29 19:30:00 |
hide comments
2015-11-28 19:43:52 Noob
To those asking "Is 1 ball in a bag allowed?" Is 1 a prime number? If yes it is not allowed. If no, it is allowed |
|
2015-11-28 19:37:28 Surendran kanagaraj
is 1 ball in a bag allowable? |
|
2015-11-28 18:44:16 Boopathi
can we take 1 bag for 1 ball ? |
|
2015-11-28 17:45:07 Noob
1 is irreducible, and also notice the IF in the Output section.;) |
|
2015-11-28 17:05:17
Last edit: 2015-11-28 17:44:30 |
|
2015-11-28 16:59:48
if it is odd number we can take 1+even for all numbers? |