1136A-Nastya Is Reading a Book,

(A) Nastya Is Reading a Book, Accepted


  1. #include<iostream>
  2. #include<stdio.h>
  3. #include<bits/stdc++.h>
  4. using namespace std;
  5. int main()
  6. {
  7.  
  8. int n,k;
  9. cin >>n;
  10. int arr[2*n];
  11. for(int j=0;j<2*n;j++)
  12. cin >>arr[j];
  13.  
  14.  
  15. cin>>k;
  16. float x=0;
  17. for(int j=0;j<2*n;j++){
  18. if(k<=arr[j])
  19. x++;
  20.  
  21. }
  22. float ans =x/2;
  23. cout<<ceil(ans);
  24. }

Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

1535A. Fair Playoff

Aptitude test assistant programmer 2018