NotAlpha102

Next Round

Feb 12th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. main()
  3. {
  4.     int n, k, i, counter=0;
  5.     scanf("%d %d", &n, &k);
  6.     int scores[n];
  7.     for(i=0; i<n; i++)
  8.     {
  9.         scanf("%d", &scores[i]);
  10.  
  11.     }
  12.    
  13.     for(i=0; i<n; i++)
  14.     {
  15.  
  16.         if(scores[i]>=scores[k-1]&&scores[i]!=0)
  17.        
  18.         {
  19.             counter=counter+1;
  20.         }
  21.  
  22.     }
  23.     printf("%d", counter);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment