Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. struct hello
  5. {
  6. int len ;
  7. int wid;
  8.  
  9. };
  10. int main() {
  11. hello st[6000];
  12. int n,a,b,i=0;
  13. cin>>n;
  14. int p=n;
  15. while(n--)
  16. {
  17. cin>>a>>b;
  18.  
  19. if(a>b)
  20. {
  21. st[i].len=a;
  22. st[i].wid=b;
  23.  
  24. }
  25. else
  26. {
  27. st[i].len=b;
  28. st[i].wid=a;
  29.  
  30. }
  31. i++;
  32. }
  33. for(int j=0;j<p;j++)
  34. {
  35. for(int k=0;k+1<p-j;k++)
  36. {
  37. if(st[j].len>st[j+1].len)
  38. {
  39. hello tmp=st[j];
  40. st[j]=st[j+1];
  41. st[j+1]=tmp;
  42. }
  43. }
  44. }
  45. for(int i=0;i<n;i++)
  46. {
  47.  
  48. }
  49.  
  50.  
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement