public static void t1() {
int[] arr = new int[]{2,5,1,1,1,1,4,1,7,3,7};
boolean flag = false;//标识,标识是否找得到m,n,q
//使得A[0]到A[m-1],A[m+1]到A[n-1],A[n+1]到A[q-1],A[q+1]到A[A.length-1]这四部分的和相等
for(int m=1;m<arr.length-1;m++) {
for(int n=3;n<arr.length-1;n++) {
for(int q=5;q<arr.length-1;q++) {
//计算A[0]到A[m-1]的和
int sum1 = 0;
for(int i=0;i<=m-1;i++) {
sum1 = sum1+arr[i];
}
//计算A[m+1]到A[n-1]的和
int sum2 = 0;
for(int i=m+1;i<=n-1;i++) {
sum2 = sum2+arr[i];
}
//计算A[n+1]到A[q-1]的和
int sum3 = 0;
for(int i=n+1;i<=q-1;i++) {
sum3 = sum3+arr[i];
}
//计算A[q+1]到A[A.length-1]的和
int sum4 = 0;
for(int i=q+1;i<arr.length;i++) {
sum4 = sum4+arr[i];
}
if(sum1 == sum2 && sum2 == sum3 && sum3 == sum4) {
System.out.println("true");
System.out.println("下标为:"+"["+m+","+n+","+q+"]");
flag = true;//找到之后,把flag变成true
}
}
}
}
if(flag==false) {
System.out.println("false");
}
}