poj 2371 Questions and answers
题目链接:http://poj.org/problem?id=2371
题意:前面给出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 0x3f3f3f3f typedef 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]);} }
View Code
转载于:https://www.cnblogs.com/wwdf/p/5781469.html
poj 2371 Questions and answers相关推荐
- 35+ Top Apache Tomcat Interview Questions And Answers【转】
原文地址:https://www.softwaretestinghelp.com/apache-tomcat-interview-questions/ Most frequently asked Ap ...
- Some Essential JavaScript Questions And Answers(6)
Some Essential JavaScript Questions And Answers Question11: Write a simple function (less than 160 c ...
- Some Essential JavaScript Questions And Answers(5)
Some Essential JavaScript Questions And Answers Question 9: Discuss possible ways to write a functio ...
- Some Essential JavaScript Questions And Answers(4)
Some Essential JavaScript Questions And Answers Question7: What is NaN? What is its type? How can yo ...
- Some Essential JavaScript Questions And Answers(3)
Some Essential JavaScript Questions And Answers Question5: What is the significance, and what are th ...
- Some Essential JavaScript Questions And Answers(2)
Some Essential JavaScript Questions And Answers Question3: What will the code below output to the co ...
- C# Interview Questions and Answers
What's C# ?C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived f ...
- English job interview Questions and Answers
"What are your goals for the future?" or "Where do you see yourself in five years?&qu ...
- Some Essential JavaScript Questions And Answers(1)
一些很经典的JavaScript探讨题,分享分享,英语好的可以忽略我的翻译. Some Essential JavaScript Questions [译]:一些必要的(基本的)JS面试题及答案 Q ...
最新文章
- freemarker内建函数介绍
- 数百个CV实战项目与必备7本书5000页中英文CV书籍以及算法工程师必备资料免费送啦~...
- Windows系统下MySQL安装详细教程(解决MySQL服务无法启动)
- Windows和Linux系统下,虚拟环境安装的全面说明和详细步骤
- MYSQL 的 MASTER到MASTER的主主循环同步
- spring-session-data-redis解决session共享的问题
- TPAMI 2020 | 高分辨率网络对计算机视觉任务的影响
- x10i升级android4.0,智再升级 Xperia X10i升Android 2.3
- 2021中国家居行业洞察白皮书
- 还是原来的配方和味道!《英雄联盟》手游界面再曝光...
- 《java程序设计》第十一周学习小结 201671010130
- python实现简单算法
- 格式化html源码正则,用正则表达式格式化html标签的代码分享
- 20172319 实验三《查找与排序》实验报告
- 客户端js 读取 json 数据
- C语言 通讯录项目完整代码
- python lcut精确分词_python 分词
- css中字体之间的距离是什么意思,css字符间距(css文字间距怎么设置)
- 通常所说的微型计算机主机主要包括,通常所说的微型计算机的主机主要包括( )。...
- 记录一次Anaconda安装Spyder失败及解决方法
热门文章
- 2021-04-10 【数据库导数】数字类型的列如果位数过长,变为科学计数法问题
- mysql查看是否开启定时器_Mysql 查看定时器 打开定时器 设置定时器时间
- iphone开蓝牙wifi上网慢_为啥我开锁总是比别人慢?
- adaboost算法java代码_04-04 AdaBoost算法代码(鸢尾花分类)
- python不同模块间传递数据_Python模块-数据传送模块
- dll注入工具_UnmanagedPowerShell工具分析
- 新电脑怎么分盘_2020双十一预算一万该怎么组装电脑(含显示器)新媒体,视频剪辑等影视专业装机指南...
- 全国大学生数学建模2019年C题机场的出租车问题论文与代码
- STM32 ISP 下载程序, C源码,
- linux 清理内存的c函数,Linux C函数之内存配置函数