HDU 2034 人见人爱A-B【STL/set】
人见人爱A-B
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 95146 Accepted Submission(s): 26564
呵呵,很简单吧?
如果n=0并且m=0表示输入的结束,不做处理。
3 7 2 5 8 2 3 4 5 6 7 8
0 0
NULL
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<set>
#include<map>
#include<sstream>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<vector>
#include<string>
using namespace std;
#define long long ll
const double PI = acos(-1.0);
const double eps = 1e-;
const int inf = 0x3f3f3f3f;
const int N = ;
int n, m, tot;
int a[N];
int t;
//34 45 56
//57 23 34
// 9 30(80/60=1
int main()
{
int b;
set<int> s;
while(cin>>n>>m)
{
s.clear(); //!!!
if(!n && !m) break;
for(int i=; i<=n; i++) {
cin>>a[i];
s.insert(a[i]);
}
for(int i=; i<=m; i++) {
cin>>b;
if(s.find(b) != s.end()) ///!!!
{
s.erase(b);
}
}
if(s.size()==) cout<<"NULL";
else
{
set<int>::iterator it = s.begin();
for( ; it!=s.end(); it++){
//if(it!=s.begin()) cout<<" ";
cout<<*it<<" "; ///!!!
}
}
cout<<endl;
}
}
HDU 2034 人见人爱A-B【STL/set】的更多相关文章
- hdu 2034 人见人爱A-B
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2034 人见人爱A-B Description 参加过上个月月赛的同学一定还记得其中的一个最简单的题目, ...
- hdu 2034人见人爱A-B
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2034 解题思路:set的基本用法 #include<iostream> #include& ...
- HDU 2034 人见人爱A-B 分类: ACM 2015-06-23 23:42 9人阅读 评论(0) 收藏
人见人爱A-B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...
- 杭电 2034 人见人爱A-B
http://acm.hdu.edu.cn/showproblem.php?pid=2034 人见人爱A-B Time Limit: 2000/1000 MS (Java/Others) Mem ...
- hdu 2035 人见人爱A^B
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2035 人见人爱A^B Description 求A^B的最后三位数表示的整数.说明:A^B的含义是“A ...
- HDU 2035 人见人爱A^B 分类: ACM 2015-06-22 23:54 9人阅读 评论(0) 收藏
人见人爱A^B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...
- hdu 6040 Hints of sd0061(stl: nth_element(arr,arr+k,arr+n))
Hints of sd0061 Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others ...
- hdu 2034 - 集合操作
题意:集合A,B,计算集合差A-B(求只在集合A内的数) 解法: 选用STL内的集合set 1.建立set 1: #include<set> 2: 3: set<int> ...
- 杭电2034——人见人爱A-B
#include <stdio.h> #include <algorithm> using namespace std; int main () { int a[110],b[ ...
随机推荐
- 11,scrapy框架持久化存储
今日总结 基于终端指令的持久化存储 基于管道的持久化存储 今日详情 1.基于终端指令的持久化存储 保证爬虫文件的parse方法中有可迭代类型对象(通常为列表or字典)的返回,该返回值可以通过终端指令的 ...
- 手把手教你启用RemoteFX以及Hyper-V GPU卸载
[TechTarget中国原创] 微软的RemoteFX特性可以帮助改善虚拟机图形密集型应用工作负载的性能. 服务器虚拟化已经成熟到大多数工作负载都能够在虚拟机内运行的程度.毫无疑问,与其他工作负载相 ...
- Windows网络编程笔记5 -- 其他套接字
包括红外线套接字(IrSock).IPX/SPX 套接字.NetBIOS 套接字.AppleTalk 套接字.ATM 套接字等.对这些套接字进行简单介绍. 第一.红外线套接字(I r S o c k) ...
- centos php环境搭建
CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境 准备篇: 1.配置防火墙,开启80端口.3306端口vi /etc/sysconfig/iptables-A ...
- yum 快速安装 Rabbitmq for CentOS6
1.安装CENTOS6的系统. 2.配置源 ,说明:https://github.com/rabbitmq/erlang-rpm To use Erlang 20.x on CentOS 6: # I ...
- docker exec小脚本
经常要使用docker exec -it containerID bash 进入docker内部进行一些操作,干脆把它写成shell脚本节省时间. # 查看需要操作的容器id $ docker ps ...
- mybitis中对象字段与表中字段名称不匹配(复制)
开发中,实体类中的属性名和对应的表中的字段名不一定都是完全相同的,这样可能会导致用实体类接收返回的结果时导致查询到的结果无法映射到实体类的属性中,那么该如何解决这种字段名和实体类属性名不相同的冲突呢? ...
- linux下telnet安装与使用
现在管理linux基本都用crt.xshell或者putty,已经没什么人用telnet,因为后续需要讲zabbix免客户端监控只telnet,通过telnet来监控服务器性能. yum安装telne ...
- linux系统mysql连接检查脚本
为了便于检查ECS服务器内部搭建的mysql或者RDS的mysql数据库,编写了一个mysql测试脚本,对于不熟悉命令行操作的朋友出现问题时可以检测一下. 脚本下载地址: http://j ...
- MAC抓包工具charles(青花瓷)
下载链接:http://pan.baidu.com/s/1pL6ClBX 配置教程:http://blog.csdn.net/jiangwei0910410003/article/details/41 ...