poj 2371 Questions and answers
来源:互联网 发布:软件购销合同书范本 编辑:程序博客网 时间:2024/06/10 01:21
题目链接:http://poj.org/problem?id=2371View Code
题意:前面给出N和N个数,中间一串字符串(分割用),后面给出M和M个询问,问第I小的数字是多少。
分析:水。。。直接sort一下,然后输出第I-1个就好(下标从0开始)。
代码:
#include<cstdio>#include<cmath>#include<cstring>#include<queue>#include<stack>#include<cstdlib>#include<string>#include<vector>#include<map>#include<string>#include<iostream>#include<algorithm>using namespace std;#define INF 0x3f3f3f3ftypedef long long ll;#define Max(a,b) (a>b)?a:b#define lowbit(x) x&(-x)int n,a[1000005];int main(){ scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } sort(a,a+n); char s[105]; scanf("%s",s); int m; scanf("%d",&m); while(m--) { scanf("%d",&n); printf("%d\n",a[n-1]); }}
0 0
- poj 2371 Questions and answers
- poj 2371 Questions and answers
- POJ 2371 Questions and answers
- poj 2371 Questions and answers
- Poj 2371--Questions and answers(QSort)
- POJ 一 2371 Questions and answers
- POJ 2371 Questions and answers(水~)
- POJ2371:Questions and answers
- POJ_2371 Questions and answers
- hdu Questions and answers
- BNU Questions and answers
- google questions and answers
- google questions and answers
- URAL 1026. Questions and answers
- gSOAP toolkit questions and answers
- .NET Interview Questions And Answers
- ural 1026 Questions and Answers
- Tibco designer questions and answers
- Apple Mach-O Linker (ld) Error Group
- poj 2368 Buttons
- poj 2369 Permutations
- poj 2370 Democracy in danger
- jmeter通过jmeter-plugins、jconsole对系统资源进行监控
- poj 2371 Questions and answers
- poj 2372 D++ Again
- HDU 5857 Median (2016 多校训#10 1001)
- HDU 5858 Hard problem (2016 多校训练#10 1002)
- HDU 5867 Water problem (2016 多校训练#10 1011)
- CodeForces 13A Numbers
- CodeForces 14A Letter
- CodeForces 14C Four Segments
- HDU 1270 小希的数表