Advertisement
Guest User

luci

a guest
Sep 27th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <cstdio>
  2.  
  3. #define MAXN 100000
  4.  
  5. int N, M, K;
  6. bool L[MAXN + 1];
  7.  
  8. int luce() {
  9.     int totale = 0;
  10.     for(int j = 0; j < N; j += M) {
  11.         int res = 0;
  12.         for(int i = j; i < M+j; i++) if(L[i]) ++res;
  13.         if(res < K) totale += K - res;
  14.     }
  15.     return totale;
  16. }
  17.  
  18. int main() {
  19.     freopen("input.txt", "r", stdin);
  20.     freopen("output.txt", "w", stdout);
  21.     scanf("%d%d%d", &N, &M, &K);
  22.     for(int i = 0; i < N; i++) scanf("%d", &L[i]);
  23.     printf("%d", luce());
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement