2^k求法 int lowbit(int x) { return x&(-x); } lowbit()的返回值就是 2^k 次方的值. 基本树形数组的模板 import java.util.*; public class Main1{ ; static int n,x,ans; static int c[] = new int [N]; static int a[] = new int [N]; public static int sum(int n){ ; ){ sum+=c[n]; n-=n…
#1579 : Reverse Suffix Array 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 There is a strong data structure called "Suffix Array" which can effectively solve string problems. Let S=s1s2...sn be a string and let S[i,j] denote the substring of S ranging f…
/*有序数组:主要是为了提高查找的效率 *查找:无序数组--顺序查找,有序数组--折半查找 *其中插入比无序数组慢 * */ public class MyOrderedArray { private long[] arr; private int items; public MyOrderedArray(int max) { arr = new long[max]; items = 0; } //数组中元素的个数 public int size(){ return items; } //折半查…