OJ-Problems-Source/HDOJ/1425_autoAC.cpp
2016-08-14 09:16:58 +08:00

26 lines
498 B
C++

#include <iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define N 1000000
using namespace std;
int a[N];
int main()
{
int n,m,i,flag=0;
while(scanf("%d%d",&n,&m)!=EOF){
for(i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
flag=n-1;
printf("%d",a[flag]);
flag-=1;
for(i=m;i>1;i--){
printf(" %d",a[flag]);
flag--;
}
cout<<endl;
}
return 0;
}