# DCP-421: Divisible Pairs Back to All Problems

Medium Math > Modular Arithmetic

You are given an array **A** of **N** non-negative integers. Your task is to count the total number of pairs in the given array whose summation is divisible by **6**. Input: ------ Input starts with an integer **T (1<=T<=20)**, denoting the number of test cases. Each case contains an integer **N (1 ≤ N ≤ 100000)** denoting the length of array **A**.<br> The next line will contain **N** integer separated by a single space between them, denoting the elements of the array **A**.<br> The array elements will be nonnegative integers having value at most **1000000000.** Output: ------- For each case of input, output the total number of pairs in the given array whose summation is divisible by **6**. Sample Input ------------ 1 5 5 4 3 2 1 Sample Output ------------- 2 ---------- **Explanation:**<br> All valid 1-based indices pairs are:<br> (1,5): summation of values= 5+1 = 6 % 6 = 0<br> (2,4): summation of values= 4+2 = 6 % 6 = 0<br>

### Problem Limits

 Language Time Limit (seconds) C 1.00 C++ 1.00 C++14 1.00 C# 2.00 Go 2.00 Java 2.00 JavaScript 2.00 Objective-C 2.00 Perl 2.00 PHP 2.00 Python 2.00 Python3 2.00 Ruby 2.00 VB.Net 2.00

# 81/361

Solve/Submission

### Ranking

# User Language Timing
01 feodorv C 0.08s
02 Morass Cpp14 0.09s
03 FariD Cpp14 0.10s
04 evan Cpp14 0.21s
05 anik_JU Cpp 0.21s
06 Rajan_sust Cpp14 0.22s
07 DynamicOvi Cpp 0.23s
08 monir769 Cpp 0.24s
09 shishir09 Cpp14 0.24s
10 Sakhawat_CoU Cpp 0.25s
11 saiful130104 Cpp 0.25s
12 nasib_mbstu Cpp 0.25s
13 orpib Cpp 0.25s
14 snake_eye Cpp14 0.25s
15 haasib Cpp 0.25s
16 unknown420 Cpp 0.25s
17 nuhu_iu Cpp 0.25s
18 mhiceiuk Cpp 0.25s
19 Superstorm Cpp 0.25s
20 Sarwar05 Cpp 0.25s
21 Sajal_Deb Cpp 0.25s
22 mehedi_01 Cpp14 0.25s
23 prateepm Cpp14 0.25s
24 clkjwdhc Cpp 0.26s
25 emrul Cpp 0.26s
26 pulak_ict_mbstu Cpp 0.26s
27 AlaminJust Cpp 0.26s
28 _c_k_r_ Cpp 0.26s
29 ssavi Cpp 0.26s
30 burhan103335 Cpp 0.26s
31 tariqiitju Cpp 0.26s
32 prantacse14 Cpp14 0.26s
33 SakibAlamin Cpp 0.26s
34 duronto20 C 0.27s
35 Ramprosad Cpp 0.27s
36 Taran Cpp 0.27s
37 khatribiru Cpp 0.27s
38 cse_nazmul Cpp 0.27s
39 rayhan50001 Cpp 0.28s
40 rithu Cpp 0.29s
41 bu_hridoy Cpp 0.29s
42 _GhOstMan_ Cpp 0.30s
43 Pure_Protea Cpp 0.33s
44 kissu_pari_na Cpp 0.34s
45 shamimjucse Cpp 0.51s
46 motaleb_ICT Cpp 0.54s
47 TarikulCSE Cpp14 0.62s
48 prodipdatta7 Cpp14 0.74s
49 Halum Cpp 0.80s
50 robin_aust Cpp 0.82s
Feedback