#include<bits/stdc++.h> using namespace std; int main() { int N, K, i, j, tmp; cin>>N>>K; int data[N]; for ( i = 0; i < N; i ++ ) cin>>data[i]; for ( i = 1; i <= K; i ++) for ( j = 0; j < N-i; j ++ ) { if(data[j]>data[j+1]) { tmp = data[j]; data[j] = data[j+1]; data[j+1] = tmp; } } cout<<data[0]; for (i = 1;i < N;i ++) cout<<" "<<data[i]; return 0; }
by: 发表于:2017-12-13 10:31:54 顶(0) | 踩(0) 回复
??
回复评论