1133搜索(三)
来源:互联网 发布:淘宝店铺异常怎么恢复 编辑:程序博客网 时间:2024/04/29 04:35
题目
- Description
给定整数序列,查询多个整数是否存在。
- Input
输入多行:
l 第1行给出整数序列大小n,查询次数m(待查询的整数可以重复), 1≤n≤100000,1≤m≤100000
l 第2行给出整数序列,每个整数绝对值不超1000000
l m行,每1行给出指定整数
- Output
对于每个测试用例:
l 输出m行,每1行给出一个查询结果,指定整数存在则输出“Yes”,否则输出“No”
注意:输出部分的结尾要求包含一个多余的空行。
- Sample Input
2 2
1 2
2
3
- Sample Output
Yes
No
#include<iostream>using namespace std;#define N 1000000int used[N*2+10];int main(){ int n,m,i,x; freopen("D://in.txt","r",stdin); scanf("%d%d",&n,&m); for(i=1;i<=n;i++) { scanf("%d",&x); used[x+N]=1; } for(i=1;i<=m;i++) { scanf("%d",&x); if(used[x+N]) printf("Yes\n"); else printf("No\n"); } return 0;}
0 0
- 1133搜索(三)
- 南邮 OJ 1133 搜索(三)
- 南邮-搜索(三)
- 继续搜索(三)
- 常用算法(搜索) 三
- 搜索引擎(三)-- 搜索器
- linux笔记(三)(文件搜索)
- 安全搜索进程内存空间(三)
- 图的搜索算法(三)
- android -- 蓝牙 bluetooth (三)搜索蓝牙
- 阿里巴巴搜索系统总结(三)
- android -- 蓝牙 bluetooth (三)搜索蓝牙
- android -- 蓝牙 bluetooth (三)搜索蓝牙
- ubuntu杂谈(三) -- 搜索软件包
- android -- 蓝牙 bluetooth (三)搜索蓝牙
- 兔子-蓝牙 bluetooth (三)搜索蓝牙
- android -- 蓝牙 bluetooth (三)搜索蓝牙
- android -- 蓝牙 bluetooth (三)搜索蓝牙
- The import javax.servlet.http.HttpServletRequest cannot be resolved
- linux命令学习DAY.1(2)
- ThinkpadE450-win7系统-无线连接开机正常,过一会就出现叹号无法连接
- fcntl设置FD_CLOEXEC标志作用
- mysql中的事务回滚
- 1133搜索(三)
- apache的开源项目-模板引擎(Velocity)_学习了两天就上手啦_源码下载
- LeetCode题解——3Sum
- Velocity 文档
- SQL迅速增加表中记录语句
- Redis 事件(2) -- 时间事件
- 27.跳台阶问题
- 详解类与类之间的几种关系
- Swift 学习之路(一)