Codeforces 706B. Interesting drink Solution

  Solution in C++:

///**********ALLAH IS ALMIGHTY************///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh    

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,i;
  6. cin>>n;
  7. int a[n+1];
  8. for(i=0; i<n; i++)
  9. {
  10. cin>>a[i];
  11. }
  12. sort(a,a+n);
  13. int m,mv;
  14. cin>>m;
  15. for(i=0; i<m; i++)
  16. {
  17. cin>>mv;
  18. cout<<upper_bound(a,a+n,mv)-a<<endl;
  19. }
  20.  
  21. }

No comments

Most View Post

Recent post

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.