import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int k = scanner.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = scanner.nextInt();
}
int sum = findAdjustedArraySum(arr, n, k);
System.out.println(sum);
}
private static int findAdjustedArraySum(int[] arr, int n, int k) {
int sum = 0;
for (int i = 0; i < n; i++) {
if (i == k - 1) {
arr[i] = -arr[i];
}
sum += arr[i];
}
return sum;
}
}
一、General Description
YHM2711 is a highly integrated, single-cell Li-ion battery charger with system power path management for space-limited portable applications. The full charger function features Trickle-charge, constant current fast charge and const…
1.研究背景与意义
项目参考AAAI Association for the Advancement of Artificial Intelligence
研究背景与意义:
肺炎是一种常见的呼吸系统感染疾病,其主要病因包括细菌、病毒和真菌等。肺炎的早期诊断对于患者的治疗和预后至关重要。传统的肺炎诊断方…
Your anti-virus program might be impacting your build performance.解决方案
在使用 AndroidStudio 时,经常会弹出框提示:Your anti-virus program might be impacting your build performance. Android Studio checked the following directories: …