풀이
졸리당
코드
#include <cstdio>
int n, m, k, cnt, res = 1e9, a[200001];
int main() {
    scanf("%d %d %d", &n, &m, &k);
    while (k--) {
        int x;
        scanf("%d", &x);
        a[x+m] = 1;
    }
    for (int i = 1; i <= n; i++) {
        cnt += a[i+m], cnt -= a[i];
        if (i >= m && cnt < res) res = cnt;
    }
    printf("%d", res);
    return 0;
}
아무말
백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조, 문제, 문제 풀이, 풀이