[STL]IP and QQ (eden)
来源:互联网 发布:胜任力测评软件 编辑:程序博客网 时间:2024/06/11 03:11
Descrption
An ip can login several qqs, and a qq can be logined by several ips.
Your task is to find which qqs have been logined by the ip and which ips have logined the qq.
output format : qq ==> [ ip1 ip2 … ] and ip ==> [ qq1 qq2 … ]
if no such qq or ip, output “no qq” and “no ip”
First input n, then n+2 lines follow..
n lines:
qq ip
2 lines:
ip // find which qqs have been logined by the ip
qq // find which ips have logined the qq.
sample input:
5 10258279649 192.168.1.45 10258279649 192.168.1.45 10258279643 192.168.1.40 10258279640 192.168.1.45 10258279641 192.168.1.30 192.168.1.45 10258279649
sample output:
192.168.1.45 ==> [ 10258279640 10258279649 ] 10258279649 ==> [ 192.168.1.45 ]
Hint
map
set
From: 黄浩然
Submission
#include <iostream>#include <map>#include <set>using namespace std;int main(){ map<string,set<string>> QQ,IP; int count; cin>>count; while(count--){ string q,i; cin>>q>>i; QQ[q].insert(i);//利用map下标访问的特性,键值不存在则插入该键 IP[i].insert(q); } string i,q; cin>>i>>q; auto iter=IP.find(i); if(iter==IP.end()) cout<<"no qq\n"; else{ cout<<i<<" ==> [ "; set<string> tem=(*iter).second; for(auto a:tem) cout<<a<<" "; cout<<"]\n"; } auto itor=QQ.find(q); if(itor==QQ.end()) cout<<"no ip\n"; else{ cout<<q<<" ==> [ "; set<string> tem=(*itor).second; for(auto a:tem) cout<<a<<" "; cout<<"]\n"; }}
阅读全文
0 0
- [STL]IP and QQ (eden)
- [STL]Priority Queue (eden)优先级队列
- 2742 Review Template and Stack (eden)
- QQ IP
- QQ HTTP代理IP
- QQ代理IP地址
- QQ IP数据库软件
- hdu3590 PP and QQ
- Eden&Survivor
- stl string and stream
- String and STL 算法
- STL next_permutation and prev_permutation
- qq ip 库ip格式转换
- QQ IP数据库 纯真版(1220)
- QQ如何查看对方IP
- QQ IP 地址查询相关
- QQ and Fition for linux
- ACM and STL-DNA Sorting
- 108 对C语言指针的总结
- qduoj LC and Prime&&hdu 5104(线性筛)
- HDU3306
- Emacs Error: Invalid function: org-babel-header-args-safe-fn
- java用户登陆窗口
- [STL]IP and QQ (eden)
- 字符串、向量和数组---C++ 基础
- qwb与李主席 状压+二分
- 简单介绍android中什么叫i18n 和L10n
- 使用VAO VBO绘制图形
- 汇编语言 实验12 编写0号中断的处理程序
- 利用网线在两台电脑之间传输文件
- 用SQL Server编写一个存储过程
- 菜鸟学php扩展 之 实战如何在扩展里调第三方函数(标准库/原生/自己写的)(六)