public static int getMax(int a,int b)
{
if(a>b)
return a;
else
return b;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int ans=0;
int[] array=new int [n];
for(int i = 0 ; i < n ; i++)
{
array[i] = sc.nextInt();
}
for(int i=0;i
for(int k=i+1;k
for(int j=k+1;j
int len=array[i]+array[j]+array[k];
int ma=getMax(array[i],getMax(array[k],array[j]));
int reat = len-ma;
if(reat>ma)
{
ans=len;
}
}
}
}
System.out.print(ans);
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)