mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
e56ca966bc
1400-1499
26 lines
498 B
C++
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;
|
|
}
|