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

Big Coefficients

Time Limit: 15000/10000 MS (Java/Others)    Memory Limit: 122768/62768 K (Java/Others)
Total Submission(s): 932    Accepted Submission(s): 399


Problem Description
F(x) is a polynomial in x with integer coefficients, here F(x) = (1+x)^a1 + (1+x)^a2 + ... + (1+x)^am. Given a1, a2, ... , am, find number of odd coefficients of F(x).
 

Input
The first line contains a single positive integer T( T <= 10000 ), indicates the number of test cases.
For each test case:
First line contains an integer N(1 <= N <= 15).
Second line contains N integers a1, a2, ..., am ( 0 <= ai <= 2^45 )
 

Output
For each test case: output the case number as shown and an the odd coefficients of F(x).
 

Sample Input
4 1 1 1 3 2 1 3 3 1 2 3
 

Sample Output
Case #1: 2 Case #2: 4 Case #3: 2 Case #4: 2
 

Hint
Case #3: (1+x) + (1+x)^3 = 2 + 4x + 3x^2 + x^3. it contains 2 odd coefficients.
Case #4: (1+x) + (1+x)^2 + (1+x)^3 = 3 + 6x + 4x^2 + x^3. it contains 2 odd coefficients.
 

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-05-12 14:48:42, Gzip enabled