Codeforces 412B Network Configuration (排序)

来源:互联网 发布:淘宝上配眼镜 编辑:程序博客网 时间:2024/06/05 01:16

题目链接:Codeforces 412B Network Configuration


题目大意:貌似是由n太不同计算速度的电脑,现在有挑选出k台来,要保证计算速度相同,问说最大可能的计算速度是多少,大的速度可以变小。


解题思路:读入数据排下序就可以了。


#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int N = 105;int main () {int n, k, a[N];scanf("%d%d", &n, &k);for (int i = 0; i < n; i++)scanf("%d", &a[i]);sort (a, a + n);printf("%d\n", a[n-k]);return 0;}


0 0
原创粉丝点击