COJ 1383 STL中的set
来源:互联网 发布:淘宝蓝冠和黄冠的区别 编辑:程序博客网 时间:2024/06/07 01:50
[STL][007]字符串查找
Time Limit: 5000 ms Memory Limit: 65536 KBTotal Submit: 40 Accepted: 1
Description
现在给你一个字典,再给出几个字符串,让你查找,这些字符串是否在其中。
Input
第一行是两个整数M,N分别表示字典数和字符串数。
第2至第M+1行,每一行是一个字典。
第M+2至第M+2+N行是徐查找的字符串。
(n<=10,0000, m<=20,0000, 字符串长度不超过10,且均为小写字母)
第2至第M+1行,每一行是一个字典。
第M+2至第M+2+N行是徐查找的字符串。
(n<=10,0000, m<=20,0000, 字符串长度不超过10,且均为小写字母)
Output
共N行,每行表示第i个字符串在不在字典中,用0表示不在,1表示在。
Sample Input
5 3
acc
cat
multiply
do
will
accept
cat
a
acc
cat
multiply
do
will
accept
cat
a
Sample Output
0
1
0
1
0
Hint
<set>
本来第一次就过了,不过没过,原因是系统给的数据出问题了,管理员看了之后才过,难怪以前没有一个人得过呢……哈哈
#include <iostream>#include <algorithm>#include <map>#include <set>#include <deque>#include <queue>#include <stack>#include <string>#include <cstring>#include <cstdio>#include <cmath>using namespace std;int main(){ set<string>p; int m,n,i; string a,b; cin>>m>>n; for(i=0;i<m;i++) { cin>>a; p.insert(a); } for(i=0;i<n;i++) { cin>>b; if(p.find(b)==p.end()) cout<<'0'<<endl; else cout<<'1'<<endl; } return 0;}
- COJ 1383 STL中的set
- COJ 1151 STL中的stack每日一水
- COJ 1236 STL中的map每日二水
- COJ 1373 STL中的map每日四水
- STL 中的SET使用方法
- STL中的set容器
- C++ STL中的set
- STL中的set容器
- STL中的set&&map
- STL中的set
- COJ 1484合并排序set
- set和map中的STL
- STL中的map和set
- STL中的set使用方法详细!!!!
- c++ STL中的set容器
- STL中的set与multiset
- STL中的map和set
- STL中的SET与MAP
- 获得当前运行的设备上的 ios版本号
- poj 1904 King's Quest tarjan求二分图的所有可选最大匹配边
- Oracle数据库startup和shutdown方式
- 基于S7-200的PLC对里程轮(增量式码盘)解码的应用
- C++学习之旅——不可以修饰为虚函数的函数
- COJ 1383 STL中的set
- C语言实现代码注释的自动删除
- Internet Connection Sharing has been disabled by the Network Administrator
- 使用URLConnection获取网页信息的基本流程
- pcntl_fork() 子进程问题
- CUDA: 共享存储器实现矩阵相乘
- 休闲实用英语:别误会这些英文的意思
- CListCtrl 报表风格,可编辑子项的完美实现
- linux常用网络命令