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 ?
Input
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 separated. Range of each number will be between 1 and 10^6.
Output
For each test case, output maximum number of collections that can be formed.
Example
Input: 2
2
1 2
3
1 2 4
Output:
1
1
hide comments
Anmol Pandey:
2015-01-24 23:47:37
To those getting WA or Runtime Error
|
|
||N0VICE||:
2014-08-18 10:16:30
No need to think too
|
|
Akshay Kamthan:
2014-08-17 07:27:17
wooh! AC in one go for the second time ;):P
|
|
Naruto uzumaki:
2014-08-15 18:16:32
DIVISION might lead to confusion . 15/2 =7 and 14/2=7 |
|
Diksha Jaiswal:
2014-06-30 21:11:40
AC in 1st attempt...5 mins code :D |
|
sarelfeniel:
2014-06-30 21:11:40
Very easy... plus it's on Cube so insanely fast!! |
|
salman:
2014-06-30 21:11:40
Range of each number will be between 1 and 10^7 . |
|
who cares:
2014-06-30 21:11:40
woww!!! it means if you are using division your solution would directly rejected!!!! :( :/ finally accepted with same logic but with * |
|
NISHANT RAJ:
2014-06-30 21:11:40
simple brute force work here.
|
Added by: | praveen123 |
Date: | 2013-08-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | IITK ACA CSE online judge |