#include<bits/stdc++.h> using namespace std; int main() {

  • [ ] int n, k; cin >> n; int a[n]; for(int i=0;i<n;i++) cin >> a[i]; for(int i=0;i<n;i++) { if(a[0] > a[i]) { k = a[i]; for(int u=i;u>=0;u--) { a[u] = a[u-1]; } a[0] = k; } for(int j=0;j<n;j++) { if(j==n-1) cout << a[j]; else cout << a[j] << " "; } cout << endl;

  • [ ] return 0;

}

0 comments

No comments so far...

Information

ID
690
Time
1000ms
Memory
256MiB
Difficulty
6
Tags
# Submissions
58
Accepted
17
Uploaded By