F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

ZYB loves Xor I

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1601    Accepted Submission(s): 709


Problem Description
Memphis loves xor very musch.Now he gets an array A.The length of A is n.Now he wants to know the sum of all (lowbit($A_i$ xor $A_j$)) $(i,j \in [1,n])$
We define that lowbit(x)=$2^{k}$,k is the smallest integer satisfied (($x$ and $2^k$)>0)
Specially,lowbit(0)=0
Because the ans may be too big.You just need to output $ans$ mod 998244353
 

Input
Multiple test cases, the first line contains an integer T(no more than 10), indicating the number of cases. Each test case contains two lines
The first line has an integer $n$
The second line has $n$ integers $A_1$,$A_2$....$A_n$
$n \in [1,5*10^4]$£¬$A_i \in [0,2^{29}]$
 

Output
For each case, the output should occupies exactly one line. The output format is Case #x: ans, here x is the data number begins at 1.
 

Sample Input
2 5 4 0 2 7 0 5 2 6 5 4 0
 

Sample Output
Case #1: 36 Case #2: 40
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 18:36:40, Gzip enabled