CDOJ--1043

原题链接:http://acm.uestc.edu.cn/problem.php?pid=1043

输出前m大的数据

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 #include<functional>
 5 using namespace std;
 6 int queue[1000005];
 7 int main()
 8 {
 9     int n,m,k;
10     while(scanf("%d%d",&n,&m)!=EOF)
11     {
12         for(k=0;k<n;k++)
13         scanf("%d",&queue[k]);
14         sort(queue,queue+n,greater<int>());
15         for(k=0;k<m;k++)
16         printf("%d ",queue[k]);
17         printf("\n");
18     }
19     return 0;
20 }
21                      

 

posted @ 2013-06-02 19:41  EtheGreat  阅读(154)  评论(0编辑  收藏  举报