数列有序!
#include <iostream> #include <algorithm> using namespace std; int main() { int n, m; while(scanf("%d %d", &n, &m) && (n != 0 || m != 0)) { int a[n]; a[0] = m; for(int i = 1; i <= n; ++ i) { scanf("%d", &a[i]); } sort(a, a + n + 1); for(int i = 0; i <= n; ++ i) { if(i) printf(" %d", a[i]); else printf("%d", a[i]); } printf("\n"); } return 0; }