(以“分类:模拟与排序 ==摘要== {{信息题|Network Configuration|http://acm.hust.edu.cn/vjudge/contest/view.action?cid{{=}}70594#problem/E|1|100|time=2015-02-...”为内容创建页面)
 
摘要: 比赛名
 
第2行: 第2行:
 
==摘要==
 
==摘要==
 
{{信息题|Network Configuration|http://acm.hust.edu.cn/vjudge/contest/view.action?cid{{=}}70594#problem/E|1|100|time=2015-02-24 12:45:53}}
 
{{信息题|Network Configuration|http://acm.hust.edu.cn/vjudge/contest/view.action?cid{{=}}70594#problem/E|1|100|time=2015-02-24 12:45:53}}
*来自寒假练习:[http://acm.hust.edu.cn/vjudge/contest/view.action?cid=70594 2015 Winter Warm up div2] E题
+
*来自寒假练习:[http://acm.hust.edu.cn/vjudge/contest/view.action?cid=70594 2015 Winter Day 1 div1] E题
 
*原题链接:http://codeforces.com/problemset/problem/412/B
 
*原题链接:http://codeforces.com/problemset/problem/412/B
 +
 
==题意==
 
==题意==
 
求n个数中第k大的数。
 
求n个数中第k大的数。

2015年2月27日 (五) 15:45的最后版本

摘要

题目链接 难度等级 完成状态 完成分数 最后编辑时间 需要注意
Network Configuration ★☆☆☆☆ 答案正确 100 2015-02-24 12:45:53

题意

求n个数中第k大的数。

题解

排序即可。

代码

412B.cpp代码已折叠
展开折叠内容
显示/移除行号
  1. #include<cstdio>
  2. #include<iostream>
  3. #include<string>
  4. #include<algorithm>
  5. using namespace std;
  6. #define dsi(n) int n;scanf("%d",&n)
  7. #define si(n) scanf("%d",&n)
  8. #define f(i,n) for(int i=1;i<=n;++i)
  9. #define fi(n) f(i,n)
  10. #define f0(i,n) for(int i=0;i!=n;++i)
  11. #define fd(i,n) for(int i=n;i>=1;--i)
  12. #define ci const int&
  13. #define foreach(i,s) for(typeof(s.begin()) i=s.begin();i!=s.end();++i)
  14. #define c(x) const x&
  15. class st
  16. {
  17. int x,y;
  18. friend bool operator <(const st&a,const st&b){return a.x<b.x;}
  19. };
  20. string s;
  21. int a[10000]={};
  22. int main()
  23. {
  24. dsi(n);dsi(k);
  25. fi(n)
  26. {
  27. si(a[i]);
  28. }
  29. sort(a+1,a+n+1);
  30. cout<<a[n-k+1]<<endl;
  31. return 0;
  32. }

著作权声明[编辑]

关于[编辑]