Codeforces 1312B. Bogosort Solution

Solution in c++:
  1. ///**********ALLAH IS ALMIGHTY************///
  2. ///AH Tonmoy
  3. ///Department of CSE,23rd batch
  4. ///Islamic University,Bangladesh
  5. #include<iostream>
  6. #include<algorithm>
  7. using namespace std;
  8. int main()
  9. {
  10.  
  11. int n,i,a[500],t;
  12. cin>>t;
  13. while(t--)
  14. {
  15. cin>>n;
  16. for(i=0; i<n; i++)
  17. cin>>a[i];
  18. sort(a,a+n);
  19. for(i=n-1; i>=0; i--)
  20. cout<<a[i]<<" ";
  21. cout<<endl;
  22.  
  23. }
  24. }

1 comment:

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

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

Powered by Blogger.