public static void main(String args[]) {
Scanner in = new Scanner(System.in);
String one = in.nextLine();
System.out.println(one);
String two = in.nextLine();
System.out.println(two);
// String three = in.nextLine();
// System.out.println(three);
in.close();
// two = "2,3,4,8,10,11";
List<Integer> collect = Stream.of(two.split(","))
.map(num -> Integer.parseInt(num))
.sorted((e1,e2)->e1-e2)
.collect(Collectors.toList());
two = StringUtils.join(collect, ",");
System.out.println(two);
String[] split = two.split(",");
int n = Integer.parseInt(one);
Map<Integer, Integer> timeMap = new HashMap<>();
for (int i = 0 ; i < split.length; i++){
int value = Integer.parseInt(split[i]);
int cur = i % n;
if (timeMap.containsKey(cur)){
Integer integer = timeMap.get(cur);
timeMap.put(cur, integer + value);
}else{
timeMap.put(cur, value);
}
}
int max = 0;
for (Integer value : timeMap.values()) {
if (value > max){
max = value;
}
}
System.out.println(max);
}
23流水线
最新推荐文章于 2025-01-12 16:25:16 发布