# DCP-241: Logic-Man Back to All Problems

Medium Data Structures > Basic Data Structures

Bangladesh is a developed country, much better relations the people of this country. This country's boys and girls are all things that much better. Programming is a big part of the people of this country. In this country, a lot of guys better in programming. So a lot of programmers are in the relationship. Helal and nuhu are good friend and good Programmer. They have girlfriends. Helal’s girlfriend name is "SMM" and Nuhu’s girlfriend name is “HONEST" .But SMM and HONEST are very talent. One day Helal, Nuhu go to a party with their girlfriend . At that time, their girlfriend said, “We'll give a problem, can you solve it?” If you can solve that problem, then you are much better programmer. SMM and HONEST give some Conditions: 1. Given that n numbers a[0],a[1]………a[n-1] 2. Each pair you do OR operation ( a[i] | a[j] ) and i<j 3. sum of all pair result Input: ------ Input starts with an integer **T (1 ≤ T ≤ 100),** denoting the number of test cases. Cases each test case starts with an integer **N (1<=N<=10^5)**, The next line contains N integers a0, a1, ..., an-1 **(  0 ≤ ai ≤ 10^8)**. The total summation of N over all test cases will be **≤ 200000.** Output: ------- For each case of input you have to print the case number and just print the desired answer . Sample Input ------------ 2 4 1 3 6 2 2 3 7 Sample Output ------------- Case 1: 29 Case 2: 7 Note In the first example 1 ,3 ,6 ,2 1 | 3 = 3 1 | 6 = 7 1 | 2 = 3 3 | 6 = 7 3 | 2 = 3 6 | 2 = 6 ans = 3 + 7 + 3 + 7 + 3 + 6 ans = 29

### 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

# 41/211

Solve/Submission

### Ranking

# User Language Timing
01 Robbinb1993 Cpp14 0.01s
02 Morass Cpp14 0.01s
03 rayhan50001 Cpp14 0.02s
04 Rifatikbal Cpp 0.02s
06 khatribiru Cpp 0.02s
07 ssavi Cpp 0.02s
08 Masum_ice Cpp 0.02s
09 pulak_ict_mbstu Cpp 0.02s
10 nurshuvo51 Cpp 0.02s
11 Saimum_140128 Cpp 0.02s
12 ovis96 Cpp14 0.02s
13 Brokenlog Cpp 0.02s
14 anik_JU Cpp 0.02s
15 Dragon_Curve Cpp 0.03s
16 Rajan_sust Cpp14 0.03s
18 BishalG Cpp 0.03s
19 humayan7711 Cpp 0.03s
20 prodipdatta7 Cpp 0.03s
21 tariqiitju Cpp14 0.03s
22 prateepm Cpp14 0.03s
23 feodorv C 0.04s
24 khmahbub20 Cpp 0.04s
25 nuhu_iu Cpp 0.04s
26 subhashis_cse Cpp 0.04s
27 The_Viper Cpp 0.05s
28 KNUTH Cpp 0.05s
29 rajdipsaha Cpp 0.05s
30 SakibAlamin Cpp14 0.05s
31 emrul Cpp14 0.05s
32 Protap_Ghose Cpp14 0.05s
33 twyu0721 Cpp 0.05s
34 mir003 Cpp 0.15s