fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int N=1e6+4;
  4. long long a[N],n;
  5. int main()
  6. {
  7. cin>>n;
  8. for(int i=0;i<n;i++) cin>>a[i];
  9. for(int i=0;i<n-1;i++)
  10. {
  11. long long ok=0;
  12. for(int j=0;j<n-i-1;j++)
  13. {
  14. if(a[j]>a[j+1])
  15. {
  16. ok=1;
  17. swap(a[j],a[j+1]);
  18. }
  19. }
  20.  
  21.  
  22. cout<<"Buoc "<<i+1<<": ";
  23. for(int x=0;x<n;x++) cout<<a[x]<<" ";
  24. cout<<endl;
  25.  
  26.  
  27. }
  28. }
  29.  
Success #stdin #stdout 0.01s 5516KB
stdin
Standard input is empty
stdout
Standard output is empty