Advertisement
Pedromaia26

ONI_A

Feb 28th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5. int n, com, prof, num, c=0, p=0, total=0, ola, i, j;
  6. long int v[100000];
  7. scanf("%d %d %d",&n, &com, &prof);
  8. num=com/2;
  9. if (com%2!=0){
  10. num++;
  11. }
  12. for (i=0;i<n;i++){
  13. scanf("%li",&v[i]);
  14. }
  15. ola=n-com+1;
  16. for (i=0;i<ola;i++){
  17. c=0;
  18. p=0;
  19. for (j=0;j<com;j++){
  20. if (v[i+c]>=prof){
  21. p++;
  22. }
  23. c++;
  24. }
  25. if (p>=num){
  26. total++;
  27. }
  28. }
  29. printf("%d\n",total);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement