【OJ】Ants acmclub.com 10913 // poj 1852

简介: #include#include#includeusing namespace std;int shu[1000010];int main(){ int i,a,b; while(scanf("%d %d",&a,&b)!=EOF){ for(...
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int shu[1000010];
int main(){
  int i,a,b;
  while(scanf("%d %d",&a,&b)!=EOF){
    for( i=0;i<a;i++)
      scanf("%d",&shu[i]);
    sort(shu,shu+a);
    while(--b)
      printf("%d ",shu[--i]);
    printf("%d\n",shu[--i]);
  }
  
  return 0;
}

目录
相关文章
|
7月前
|
Java
hdu-2112-HDU Today(dijkstra + map)
hdu-2112-HDU Today(dijkstra + map)
24 0
|
网络架构
POJ 3250 Bad Hair Day、POJ 2796 Feel Good(单调栈)
POJ 3250 Bad Hair Day、POJ 2796 Feel Good(单调栈)
UVa10596 - Morning Walk(并查集)
UVa10596 - Morning Walk(并查集)
59 0
洛谷P1825-[USACO11OPEN]Corn Maze S(BFS)
洛谷P1825-[USACO11OPEN]Corn Maze S(BFS)
洛谷P1825-[USACO11OPEN]Corn Maze S(BFS)
|
机器学习/深度学习
POJ 1775 (ZOJ 2358) Sum of Factorials
POJ 1775 (ZOJ 2358) Sum of Factorials
146 0
HDOJ(HDU) 2061 Treasure the new start, freshmen!(水题、)
HDOJ(HDU) 2061 Treasure the new start, freshmen!(水题、)
135 0