inverse

Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 193    Accepted Submission(s): 97

Problem Description
Mike has got a huge array b, and he is told that the array is encrypted.

The array is encrypted as follows.

Let ai(0≤i<n) be the i-th number of this original array.

Let bi(0≤i<n) be the i-th number of this encrypted array.

Let n be a power of 2, which means n=2k.

The bi is calculated as following.

bi=∑0≤j<nf((i or j) xor i)aj

f(x) means, if the number of 1 in the binary of x is even, it will return 1, otherwise 0.

Mike want to inverse the procedure of encryption.

Please help him recover the array a with the array b.

 
Input
The first line contains an integer T(T≤5), denoting the number of the test cases.

For each test case, the first line contains an integer k(0≤k≤20),
The next line contains n=2k integers, which are bi respectively.

It is guaranteed that, ai is an integer and 0≤ai≤109.

 
Output
For each test case, output ''Case #t:'' to represent this is the t-th case. And then output the array a.
 
Sample Input
2
0
233
2
5 3 4 10
 
Sample Output
Case #1: 233
Case #2: 1 2 3 4
 
Source
 
Recommend
 
 

hdu 5244 inverse(分治¥)的更多相关文章

  1. hdu 5016 点分治(2014 ACM/ICPC Asia Regional Xi'an Online)

    Mart Master II Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

  2. HDU 6128 Inverse of sum(同余)

    http://acm.hdu.edu.cn/showproblem.php?pid=6128 题意:有一个a数列,并且每个数都小于p,现在要求有多少对$(i,j)$满足$\frac{1}{a_i+a_ ...

  3. 2017ACM暑期多校联合训练 - Team 7 1009 HDU 6128 Inverse of sum (数学计算)

    题目链接 Problem Description There are n nonnegative integers a1-n which are less than p. HazelFan wants ...

  4. 2017多校第7场 HDU 6128 Inverse of sum 推公式或者二次剩余

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6128 题意:给你n个数,问你有多少对i,j,满足i<j,并且1/(ai+aj)=1/ai+1/a ...

  5. HDU 5322 Hope (分治NTT优化DP)

    题面传送门 题目大意: 假设现在有一个排列,每个数和在它右面第一个比它大的数连一条无向边,会形成很多联通块. 定义一个联通块的权值为:联通块内元素数量的平方. 定义一个排列的权值为:每个联通块的权值之 ...

  6. HDU 4812 (点分治)

    题目:https://vjudge.net/contest/307753#problem/E 题意:给你一颗树,树上每个点都有个权值,现在问你是否存在 一条路径的乘积 mod 1e6+3  等于 k的 ...

  7. E - D Tree HDU - 4812 点分治+逆元

    这道题非常巧妙!!! 我们进行点分治的时候,算出当前子节点的所有子树中的节点,到当前节点节点的儿子节点的距离,如下图意思就是 当前节点的红色节点,我们要求出红色节点的儿子节点绿色节点,所有绿色的子树节 ...

  8. HDU 4916 树分治

    Mart Master II Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  9. Hdu 6268 点分治 树上背包 bitset 优化

    给你一颗大小为n(3000)的树,树上每个点有点权(100000),再给你一个数m(100000) i为1~m,问树中是否存在一个子图,使得权值为i. 每次solve到一个节点 用一个bitset维护 ...

随机推荐

  1. Vue的插值与表达式

    正常情况我们在页面取值都是通过 {{ data }}来取值,但是有时候我们就是想输出HTML,而不是将数据解析后的纯文本,这个时候可以使用v-html来绑定数据 <span v-html=&qu ...

  2. .Net自带ChartControl报错:Auto interval does not have proper value

    出现这个错误的原因是我们给ChartControl同时设置了Minimum和Maxmum的值,而这两个值又恰好相等. chart.ChartAreas[0].AxisY.Minimum=min; ch ...

  3. 前端基础 & 初识JS(JavaScript)

    JavaScript概述 JavaScript的历史 1992年Nombas开发出C-minus-minus(C--)的嵌入式脚本语言(最初绑定在CEnvi软件中),后将其改名ScriptEase(客 ...

  4. python并发编程&多进程(二)

    前导理论知识见:python并发编程&多进程(一) 一 multiprocessing模块介绍 python中的多线程无法利用多核优势,如果想要充分地使用多核CPU的资源(os.cpu_cou ...

  5. RemoveDuplicatesfromSortedArray

    Given a sorted array, remove the duplicates in place such that each element appear only once and ret ...

  6. scrapy+mongodb报错 TypeError: name must be an instance of str

    经过各种排查,最后找到原因,在settings文件中配置文件大小写写错了,在pipelines中 mongo_db=crawler.settings.get('MONGODB_DB'),get 获取的 ...

  7. nodejs koa2 获取get值和post值,提交表单

    // 获取get值 router.get('/b', async(ctx, next) => { ctx.state = { title: 'Koa2', name: '小明-list' } l ...

  8. Log Explorer 恢复误删除、更新数据

    一.介绍 详细参考:https://blog.csdn.net/jinjazz/article/details/2459692 转自:https://blog.csdn.net/hch27151099 ...

  9. adb通过TCP/IP连接提示 unable to connect to *, Connection refused的解决方法

    通过串口连接板子进入命令行,然后执行: su setprop service.adb.tcp.port 5555 stop adbd start adbd

  10. python更新模块

    pip install -U 模块名 # 这是 python2+ 版本的用法更新模块 pip3 install -U 模块名 # 这是 python3+ 版本的用法更新模块