hdu 5244 inverse(分治¥)
inverse
Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 193 Accepted Submission(s): 97
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.
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.
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.
0
233
2
5 3 4 10
Case #2: 1 2 3 4
hdu 5244 inverse(分治¥)的更多相关文章
- 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 ...
- HDU 6128 Inverse of sum(同余)
http://acm.hdu.edu.cn/showproblem.php?pid=6128 题意:有一个a数列,并且每个数都小于p,现在要求有多少对$(i,j)$满足$\frac{1}{a_i+a_ ...
- 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 ...
- 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 ...
- HDU 5322 Hope (分治NTT优化DP)
题面传送门 题目大意: 假设现在有一个排列,每个数和在它右面第一个比它大的数连一条无向边,会形成很多联通块. 定义一个联通块的权值为:联通块内元素数量的平方. 定义一个排列的权值为:每个联通块的权值之 ...
- HDU 4812 (点分治)
题目:https://vjudge.net/contest/307753#problem/E 题意:给你一颗树,树上每个点都有个权值,现在问你是否存在 一条路径的乘积 mod 1e6+3 等于 k的 ...
- E - D Tree HDU - 4812 点分治+逆元
这道题非常巧妙!!! 我们进行点分治的时候,算出当前子节点的所有子树中的节点,到当前节点节点的儿子节点的距离,如下图意思就是 当前节点的红色节点,我们要求出红色节点的儿子节点绿色节点,所有绿色的子树节 ...
- HDU 4916 树分治
Mart Master II Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- Hdu 6268 点分治 树上背包 bitset 优化
给你一颗大小为n(3000)的树,树上每个点有点权(100000),再给你一个数m(100000) i为1~m,问树中是否存在一个子图,使得权值为i. 每次solve到一个节点 用一个bitset维护 ...
随机推荐
- Python代码实现删除一个list里面的重复元素
lst=[11,22,33,44,22,11,22,44] print(list(set(lst))) # 打印结果:[33, 11, 44, 22] d = {} for index,item in ...
- Selenium获取input输入框中值的几种方法
1.selenium 自带的方法 get_attribute('value') driver.find_element_by_name("f[url]").get_attribut ...
- Spring学习笔记4—流程(Spring Web Flow)
Spring Web Flow是Spring框架的子项目,作用是让程序按规定流程运行. 1 安装配置Spring Web Flow 虽然Spring Web Flow是Spring框架的子项目,但它并 ...
- 【WEB HTTP】缓存
1. HTTP并不支持兄弟缓存,所以人们通过一些协议对HTTP进行了扩展,比如因特网缓存协议(Internet Cache Protocol, ICP)和超文本缓存协议(HyperText Cachi ...
- python基础23 -----进程和线程
一.进程 1.什么是进程? 1.1 进程就是一个程序在一个数据集上的一次动态执行过程.进程一般由程序.数据集.进程控制块三部分组成. 1.2 程序是指进程需要完成那些功能以及如何完成. 1.3 数据集 ...
- What's the difference between 'Even if' and 'Even though'?
为一个英语词组语法写一篇Blog: even if 与 even though 这两个词组大致意思相当,但强调的侧重有所不同. even if与even though的区别: even if一般引导的 ...
- Google Cloud Platfrom中运行基础的Apache Web服务
Links: https://cloud.google.com/compute/docs/tutorials/basic-webserver-apache 步骤: 1.安装Apache 2.重写Apa ...
- 小数据池、is 和 ==的区别
小数据池,在一定情况下出现内存共享(只有int 和 str 才有的) is 和 ==的区别 id() 打印数据的地址 a = 'hello' b = 'hello' print(a = ...
- linux mint —— 图片一张
概述 Linux Mint是一種基於Ubuntu開發出的Linux操作系统.由Linux Mint Team团队于2006年开始发行.Linux Mint 的目标是为家庭用户和企业客户提供一个免费.高 ...
- Windows虚拟机安装Linux系统
windows系统安装linux centos虚拟系统 1.下载 VMware Workstation Pro并安装,效果如图 2.下载linux系统 https://www.centos.org/d ...