3 2 -> input : N,M 값 11 7 13 -> input : 동작별 반복되는 횟수 ( 동작의 수인 N개만큼 입력해야한다. ) 7 -> output : 쪽팔림의 최소 횟수
#include <stdio.h>
void main(){
int M;
int N[200] = { 0, };
int n;
int i;
int temp;
int plus=0;
printf("최대 동작 수와 알고 있는 동작 수를 입력하시오.\n");
scanf("%d %d", &n, &M);
printf("각 동작 별 반복되는 횟수를 입력하시오\n");
for (i = 0; i < n; i++){
scanf("%d", &N[i]);
}
for (i = 0; i < n; i++){
if (N[i + 1] < N[i]){
temp = N[i + 1];
N[i + 1] = N[i];
N[i] = temp;
}
}
for (i = 0; i < n-M; i++){
plus = plus + N[i];
}
printf("쪽팔림의 최솟값은 %d입니다.\n", plus);
return 0;
}