摘要: 转自 https://www.cnblogs.com/RabbitHu/p/BIT.html1. 单点修改 + 区间查询最简单的树状数组就是这样的:void add(int p, int x){ //给位置p增加x while(p #include#inclu... 阅读全文
posted @ 2018-07-31 16:08 ~~zcy 阅读(111) 评论(0) 推荐(0) 编辑
摘要: CA sequence a1,a2,…,an is called good if, for each element ai, there exists an element aj (i≠j) such that ai+aj is a power of two (tha... 阅读全文
posted @ 2018-07-31 13:24 ~~zcy 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 具体模板详见 https://blog.csdn.net/zcy19990813/article/details/81297476Color the ballN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a #include #... 阅读全文
posted @ 2018-07-31 13:24 ~~zcy 阅读(143) 评论(0) 推荐(0) 编辑
摘要: lowbit函数顾名思义,lowbit这个函数的功能就是求某一个数的二进制表示中最低的一位1,举个例子,x = 6,它的二进制为110,那么lowbit(x)就返回2,因为最后一位1表示2。求lowbit的两种方法int lowbit(x) { retur... 阅读全文
posted @ 2018-07-31 11:04 ~~zcy 阅读(99) 评论(0) 推荐(0) 编辑