CNTDO - Count Doubles
You are given an array of integers. Your task will be to determine how many integers in the array are twice of some other integers in the same array. For example, consider an array:
1 3 4 7 9 2 18
Here answer is 3 as 2 is twice of 1, 4 is twice of 2 and 18 is twice of 9.
Input
The first line of the input will be an integer T (T ≤ 1000) to represent the number of test cases. Each test case will contain two lines. The first line contains integer N (1 ≤ N ≤ 1000) which indicates the number of distinct integers in the given array. The second line contains N integers and each integer will not be greater than 10000 by its absolute value.
Output
In a single line, output the count of the integers that are double of some other integer.
Example
Input: 2 7 1 3 4 7 9 2 18 3 1 4 3 Output: 3 0
hide comments
Francky:
2016-07-01 13:30:10
To be moved to tutorial ASAP ; please. |
|
azam_9:
2016-07-01 13:24:58
silly mistake costed me MANY WA's..by the way nice question.. |
|
[Lakshman]:
2016-07-01 13:08:38
Please move this to tutorial or basic. 2 line in Python is enough for this. |
Added by: | Akid Sultan |
Date: | 2016-06-30 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |