IITKWPCO - Create Collections
Little Feluda likes to play very much. As you know he only plays with numbers. So he is given n numbers. Now tries to group the numbers into disjoint collections each containing two numbers. He can form the collection containing two numbers iff small number in the collection is exactly half of large number.
Given n numbers, Find out how many maximum number of collections he can form ?
T: number of test cases. (1 <= T <= 100).
For each test case:
First line will contain n : (1 <= n <= 100)
Then next line will contain n numbers single space seperated. Range of each number will be between 1 and 10^6.
For each test case, output maximum number of collections that can be formed.
1 2 4
|Cluster:||Cube (Intel Pentium G860 3GHz)|
|Languages:||All except: SCM chicken|
|Resource:||IITK ACA CSE online judge|
Easy AC in 1 go :D
To those getting WA or Runtime Error
No need to think too
wooh! AC in one go for the second time ;):P
DIVISION might lead to confusion . 15/2 =7 and 14/2=7
AC in 1st attempt...5 mins code :D
Very easy... plus it's on Cube so insanely fast!!
Range of each number will be between 1 and 10^7 .
woww!!! it means if you are using division your solution would directly rejected!!!! :( :/ finally accepted with same logic but with *