SCU4490 Lisp em(string和map容器的应用)
来源:互联网 发布:金融分析软件 编辑:程序博客网 时间:2024/05/16 14:27
题目:
Time Limit: 1000 MS Memory Limit: 131072 KDescription
There are two lists and they may be intersected with each other.You must judge if they are intersected and find the first node they have in common.Input
The first line is the number of cases.Each case consists of two lists.Each list consists of multiple nodes.Each node is represented by its address in memory.So, a list may look like this: 0x233333 0x123456 0xabcdef1 0xffffff nilnil is the end of the list.All lists have no cycle.The length of list is not larger than 4e5.List can't be empty.Warn: huge input.Output
"No" if they are not intersected."Yes Address", if they are intersected, print "Yes" and the address of their first common node.Sample Input
20x233333 0x123456 0xabcdef1 0xffffff nil0x999999 0x332232 0xffffff nil0x233333 0x123456 0xabcdef1 0xffffff nil0x987654 0xafafaf 0xfffcccc 0xaaface nilSample Output
Yes 0xffffffNoAuthor
qw4990
这就没什么思路了,一看代码肯定懂了,注意细节就好,存一存代码~
代码:
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <iostream>#include <cstring>#include <vector>#include <map>#include <string>#define N 500#define LL long long#define mem(a,b) memset(a,b,sizeof(a))using namespace std;string s;map<string,int>mp;vector<string>a;int main(){ int t; scanf("%d",&t); while(t--) { s.clear(); a.clear(); mp.clear(); while(cin>>s&&s!="nil") mp[s]=1; while(cin>>s&&s!="nil") if(mp[s]==1) a.push_back(s); if(a.size()==0) printf("No\n"); else cout<<"Yes"<<" "<<a[0]<<endl; } return 0;}
0 0
- SCU4490 Lisp em(string和map容器的应用)
- SCU4490: Lisp em(STL)
- map+string容器的应用(D题Football Match)
- C++ string和map容器实现简单的英文翻译
- map的lisp实现
- Lisp em
- C++ map容器的应用
- Common Lisp的标准容器
- em与px的区别以及em特点和应用
- zju-1159-map容器的应用
- 容器map的应用:CodeForces - 501B
- hdu-6015map容器的应用
- Map容器与multimap容器应用的小知识
- map容器简单应用
- map容器应用
- Lisp em SCU
- map和string的用法
- Map<String, ?>和Map<String, Object>的区别
- 4. 互联网思维
- [大力容斥] 省选模拟赛 4 B. 买买买 buy
- 【BZOJ】2815: [ZJOI2012]灾难
- 地牢逃脱
- poj 2674 Linear world
- SCU4490 Lisp em(string和map容器的应用)
- 剑指offer 判断数组的后序遍历是否为搜索二叉树
- CSS样式书写规范与命名规则
- 【项目经验】org.hibernate.NonUniqueResultException: query did not return a unique result: 3
- laytpl error:no data报错
- 杭电 1106
- stm32自学笔记 系统时钟
- 程序的机器级表示
- 赋值运算符——交换扑克牌