<span style="font-family: Arial, Helvetica, sans-serif;">/*</span>
* 求子数组中等于某个值K的起始坐标
*/
public void getNum(int[] a,int k){
HashMap<Integer, Integer> map = new HashMap<>();
int[] ss = new int[a.length];
int currentNum =0;
for (int i = 0; i < a.length; i++) {
currentNum +=a[i];
ss[i] = currentNum;
map.put(currentNum, i);
}
for (int i = ss.length-1; i >0; i--) {
int tmp = ss[i] -k;
if (map.get(tmp)!= null) {
System.out.println(i+" "+ map.get(tmp));
}
}
}