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

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.