import java.util.Scanner; public class Main { public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int [] a = new int[n]; for(int i = 0; i<n; i++){
a[i] = sc.nextInt(); }
System.out.println(langest(a,n,m,k)); } public static int langest(int [] a, int n, int m, int k){ int sum = 0; int max = 0; int nn = 0; for(int i = 0; i<n; i++){
nn = 0; for(int j = i+1; j<n; j++){ //for(int mm = i; mm<j; mm++){ if(j-i >= k && nn < m) {
sum = a[i] + a[j]; nn = nn +2; } if(sum > max)
max = sum; } //} } return max; }
}
在IEDA平台测没问题,不知道是不是能覆盖所有测试用例