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
 
 

最新文章

  1. DOM0编程与基础方法
  2. TODO:小程序手机预览调试
  3. session过期时间
  4. PAT 1005. 继续(3n+1)猜想 (25) JAVA
  5. GridView合并表头、多重表头(转)
  6. github生成燃尽图
  7. 如何在VS2013中新建WindowsService定时任务
  8. C#处理Json文件
  9. python 函数的参数对应
  10. hdoj 1285 确定比赛名次【拓扑排序】
  11. cocos2d-x 找不到资源文件问题
  12. Nodejs进阶:核心模块Buffer常用API使用总结
  13. hdu5673 Robot 卡特兰数 / 默慈金数
  14. python学习笔记 函数
  15. Tinyhttpd for Windows
  16. Android studio 2 版本升级 Android studio 3 版本注意事项
  17. 原生js显示消失
  18. (8)socketserver并发
  19. 关于PHP批量图片格式转换的问题--本文转成webp, 其他过程格式一样
  20. python虚拟环境搭建

热门文章

  1. 什么是PHP闭包???
  2. ExtJS4 给同一个formpanel不同的url
  3. openssl之EVP系列之7---信息摘要算法结构概述
  4. 剑指offer 面试20题
  5. LeetCode:二叉树的层次遍历||【107】
  6. libstdc和glibc的一些共享库问题
  7. [APIO2013]机器人
  8. java 跨数据库导入大数据
  9. CSS3展开带弹性动画的手风琴菜单
  10. Object.defineProperty小解