Блог пользователя DijkstraAlgorithm

Автор DijkstraAlgorithm, история, 17 месяцев назад, По-английски
Interesting Pairs

                                      time limit : 2 sec
                                      Memory limit : 256 MegaBytes

A pair ( x , y ) is called an interesting pair if it holds the following condition :- 1. x < y. 2. x is even , y is odd.

Given an array of n integers , you have to count the total no of interesting pairs.

Input format : the first line of input contains T (T<1000) the no of test cases , next two lines of each test case will contain description of each test case ,length of array n and the elements of array a1,a2,a3,.....,an (ai<10^5) .

It is guarranted that sum of n over all test cases doesn't exceed 2 * 10^5.

Output Format : the only line of output for each test case contains the total of interesting pairs.

Input : 2 10 1 2 3 4 5 6 7 8 9 10 4 2 4 10 12

Output : 10 0

Input : 1 6 4 11 5 6 9 3

Output : 8

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится