郑州专业建网站,宣传画册设计,自助网页制作免费,怀柔做网站的吗【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 用mapset写个模拟就好。 3个区域 书架、桌子、别人的手上。 其中前两个区域的书都能借出去。 【代码】 #include bits/stdc.h
using namespace std;set pairstring, string mset1,mse… 【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 用mapset写个模拟就好。 3个区域 书架、桌子、别人的手上。 其中前两个区域的书都能借出去。 【代码】 #include bits/stdc.h
using namespace std;set pairstring, string mset1,mset2,mset3;
mapstring, string author;
string s1,s2,s3;int main()
{//freopen(F:\\rush.txt, r, stdin);while (getline(cin,s1)){if(s1 END) break;s2 ;int now 1;while (s1[now] ! ) s2 s1[now];assert(s1[now] );now5;s3 s1.substr(now);mset1.insert(make_pair(s3, s2));author[s2] s3;}while (getline(cin, s1)){if (s1 END) break;if (s1[0] B){s2 s1.substr(8);s2.erase((int)s2.size() - 1);auto it mset1.find(make_pair(author[s2], s2));if (it ! mset1.end()){mset3.insert((*it));mset1.erase(it);}else {it mset2.find(make_pair(author[s2], s2));if (it ! mset2.end()){mset3.insert((*it));mset2.erase(it);}}}else if (s1[0] R){s2 s1.substr(8);s2.erase((int)s2.size() - 1);auto it mset3.find(make_pair(author[s2], s2));if (it ! mset3.end()){mset2.insert((*it));mset3.erase(it);}}else {for (auto temp : mset2){mset1.insert(temp);auto it mset1.find(temp);if (it ! mset1.begin()){it--;cout Put temp.second after (*it).second endl;}elsecout Put temp.second first endl;}cout END endl;mset2.clear();}}return 0;
} 转载于:https://www.cnblogs.com/AWCXV/p/7671009.html