From f7c7e7328cb337bcf6f380d32bcf59dd83f5bbc6 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 7 May 2016 20:57:34 +0800 Subject: [PATCH] Create 230_Richr_Wong.cpp From http://blog.csdn.net/richr_wong/article/details/50193331 --- UVA/230_Richr_Wong.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 UVA/230_Richr_Wong.cpp diff --git a/UVA/230_Richr_Wong.cpp b/UVA/230_Richr_Wong.cpp new file mode 100644 index 0000000..aa61df2 --- /dev/null +++ b/UVA/230_Richr_Wong.cpp @@ -0,0 +1,61 @@ +#include +#include +#include +#include +#include +using namespace std; +const int maxx=1010; +typedef struct Node +{ + string book,name; + bool operator<(const struct Node &x)const + { + if(name!=x.name) return name st; + map mp; + string s; + node tnode; + int p; + while(getline(cin,s)) + { + if(s[0]=='E') break; + p=s.find('"',1); + tnode.book=s.substr(0,p+1); + tnode.name=s.substr(p+5); + mp.insert(make_pair(tnode.book,tnode.name)); + st.insert(tnode); + } + set st1; + while(getline(cin,s)) + { + if(s[0]=='E') break; + if(s[0]=='S') + { + set::iterator it,it1; + for(it=st1.begin();it!=st1.end();it++) + { + cout<<"Put "<book<<" "; + it1=st.lower_bound(*it); + if(st.empty()||it==st.begin()) cout<<"first"<book<