UVa156(map的使用)
来源:互联网 发布:东方财富软件使用 编辑:程序博客网 时间:2024/05/29 02:59
//思路:用map<string,int>记录重排string后出现的次数,如果为1次,就是我们想要的结果
AC源码:
#include <iostream>#include <string>#include <vector>#include <algorithm>#include <map>#include <cctype>using namespace std;map<string,int> cnt;vector<string> svec;void solve(){string buf;while(cin>>buf){if(buf=="#")break;svec.push_back(buf);for(int i=0;i<buf.length();++i)buf[i]=tolower(buf[i]);sort(buf.begin(),buf.end());if(!cnt[buf])cnt[buf]=0;cnt[buf]++;}sort(svec.begin(),svec.end());vector<string> ans;for(int i=0;i<svec.size();++i){string tmp=svec[i];for(int i=0;i<tmp.length();++i)tmp[i]=tolower(tmp[i]);sort(tmp.begin(),tmp.end());if(cnt[tmp]==1)ans.push_back(svec[i]);}for(int i=0;i<ans.size();++i)cout<<ans[i]<<endl;}int main(){solve();return 0;}
阅读全文
0 0
- UVa156(map的使用)
- uva156 Ananagrams (stl map的使用)
- Uva156 map容器的使用 sortvecor And map.count
- UVA156对于map的学习
- UVa156 map
- map函数的应用:UVa156-Ananagrams
- UVa156 Ananagrams,map
- UVa156 Ananagrams ACM解题报告(巧妙的map)
- UVa156 map set vector/STL
- UVA156 map与set运用
- uva156
- UVA156
- uva156
- uva156
- UVA156
- UVa156
- UVa156
- uva156
- kotlin学习2(第一个hello word 程序)
- 深度优先搜索版的匈牙利算法
- 略讲基于cnn的人脸识别模型的网络结构和度量设计
- 355Design Twitter
- 单片机学习——LCD12864串口显示
- UVa156(map的使用)
- hihoCoder— 穿越禁区(并查集)
- HorizontalScrollView和ViewPager的使用
- CSS之vmin和vmax
- 实现javascript深复制
- General Thread States
- android系统源码下载
- HTML基础学习-3- image标签学习
- python-01