Saleh127

uva 10905

Jun 28th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9. int t,i,j;
  10. while(cin>>t && t)
  11. {
  12. string a[10000];
  13. for(i=0;i<t;i++)
  14. {
  15. cin>>a[i];
  16. }
  17. string x;
  18. for(i=0;i<t;i++)
  19. {
  20. for(j=i+1;j<t;j++)
  21. {
  22. if(a[i]+a[j]>a[j]+a[i])
  23. {
  24. swap(a[i],a[j]);
  25. }
  26. }
  27. }
  28. for(i=t-1;i>=0;i--)
  29. {
  30. cout<<a[i];
  31. }
  32. cout<<endl;
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment