# 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

# 84/373

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
11 Sajal_Deb Cpp 0.25s
12 mehedi_01 Cpp14 0.25s
13 prateepm Cpp14 0.25s
14 Sakhawat_CoU Cpp 0.25s
15 saiful130104 Cpp 0.25s
16 nasib_mbstu Cpp 0.25s
17 orpib Cpp 0.25s
18 snake_eye Cpp14 0.25s
19 haasib Cpp 0.25s
20 unknown420 Cpp 0.25s
21 nuhu_iu Cpp 0.25s
22 mhiceiuk Cpp 0.25s
23 Superstorm Cpp 0.25s
24 Sarwar05 Cpp 0.25s
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 clkjwdhc Cpp 0.26s
35 duronto20 C 0.27s
37 Taran Cpp 0.27s
38 khatribiru Cpp 0.27s
39 cse_nazmul Cpp 0.27s
40 rayhan50001 Cpp 0.28s
41 rithu Cpp 0.29s
42 bu_hridoy Cpp 0.29s
43 _GhOstMan_ Cpp 0.30s
44 Pure_Protea Cpp 0.33s
45 kissu_pari_na Cpp 0.34s
46 shamimjucse Cpp 0.51s
47 motaleb_ICT Cpp 0.54s
48 FalseTrueFalse Cpp 0.55s
49 TarikulCSE Cpp14 0.62s
50 prodipdatta7 Cpp14 0.74s
Feedback