fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int a[100],LEN,b[100];
  5. scanf("%d",&LEN);
  6. for(int i=0; i<LEN; i++)
  7. {
  8. scanf("%d",&a[i]);
  9. }
  10. for(int i=0; i<LEN; i++)
  11. {
  12. b[i]=a[i];
  13. }
  14. for(int i=0; i<LEN-1; i++)
  15. {
  16.  
  17. for(int j=i+1; j<LEN; j++)
  18. {
  19. if(a[i]>a[j])
  20. {
  21. int temp=a[j];
  22. a[j]=a[i];
  23. a[i]=temp;
  24. }
  25. }
  26. }
  27.  
  28. for(int i=0; i<LEN; i++)
  29. {
  30. printf("%d ",a[i]);
  31. }
  32. printf("\n");
  33. int q;
  34.  
  35. if(LEN%2==0)
  36. {
  37. int k=LEN/2;
  38. int m;
  39. if(a[k]>a[k-1])
  40. {
  41. m=k;
  42. }
  43. else
  44. {
  45. m=k-1;
  46. }
  47. q=a[m];
  48. }
  49.  
  50.  
  51.  
  52. else
  53. {
  54. int n=LEN/2;
  55.  
  56. q=a[n];
  57. }
  58. for(int i=0; i<LEN-1; i++)
  59.  
  60. {
  61. printf("%d ",a[i]);
  62. }
  63. int v;
  64. for(int i=0; i<LEN-1; i++)
  65. {
  66. if(b[i]==q)
  67. {
  68. v=i;
  69. break;
  70. }
  71.  
  72. }
  73. for(int i=v; i<LEN-1; i++)
  74. {
  75. int t=b[i];
  76. b[i]=b[i+1];
  77. }
  78. LEN--;
  79. printf("\n");
  80.  
  81. for(int i=0; i<LEN; i++)
  82. {
  83. printf("%d ",b[i]);
  84. }
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
-738463850 -738461696 -738338320 0 1 5289 5289 5289 
-738463850 -738461696 -738338320 0 1 5289 5289 
-738338320 5289 -738463850 5289 0 -738461696 5289