HDU-1075 What Are You Talking About (STL:map)
来源:互联网 发布:python 正态分布函数 编辑:程序博客网 时间:2024/06/11 13:14
题目链接: The kth great number
思路: map的运用
# 输入一整行的字符串包括空格 -
getline(cin,ss);#查找元素是否在容器中
if(ma.find(value)!=ma.end())//是返回真,否返回假
CODE:
#include <iostream>#include<stdio.h>#include<cctype>#include<string>#include<map>#include<set>#include<queue>#include<stack>#include<vector>using namespace std;string s[15];int main(){ //freopen("in.in","r",stdin); map<string,string> ma; int n=0; string s1,s2; cin>>s1; while(s1[0]!='E') { if(s1[0]!='S') { cin>>s2; ma[s2]=s1; } cin>>s1; } string ss; getchar(); getline(cin,ss); while(ss[0]!='E') { getline(cin,ss); if(ss[0]!='E') { int t=0; for(int i=0;i<ss.size();i++) { if(!isalpha(ss[i])) { string value(ss,t,i-t); if(ma.find(value)==ma.end()) ma[value]=value; cout<<ma[value]; while(!isalpha(ss[i])&&i<ss.size()) { cout<<ss[i]; i++; } t=i; } } if(ss[0]!='E')printf("\n"); } } return 0;}
0 0
- HDU-1075 What Are You Talking About (STL:map)
- STL-map--what are you talking about
- hdoj 1075 What Are You Talking About 【STL map+string】
- HDU 1075:What Are You Talking About【字典树 & STL】
- hdu 1075 What Are You Talking About STL的使用
- hdu 1075 What Are You Talking About< map<string,string> >
- hdu 1075 What Are You Talking About (map)
- hdu 1075 What Are You Talking About(map)
- HDU 1075 What Are You Talking About(map运用)
- HDU 1075-What Are You Talking About(map)
- HDU 1075 What Are You Talking About 【map + find】
- hdu 1075 What Are You Talking About(map)
- HDU 1075 What Are You Talking About(map+字符串)
- hdu 1075 What Are You Talking About map
- HDU- 1075 What Are You Talking About (Trie or map)
- HDU 1075 What Are You Talking About map
- hdu 1075-What Are You Talking About(Map&&字典树)
- hdu 1075 What Are You Talking About 字典树 或 stl map
- 深入剖析C++中的string类
- 拥有梦想的人不做选择题,他们只做证明题
- 外观模式
- html5与以往版本的不同(一)
- Android性能优化——工具篇
- HDU-1075 What Are You Talking About (STL:map)
- cocos2d-x 中的pvr.ccz压缩图片的使用方法
- Linux的rpm命令参数使用详解
- 支撑5亿用户、1.5亿活跃用户的Twitter最新架构详解及相关实现
- 搭建Android开发环境与测试环境
- 九度1500
- Android--服务器推送
- 职场中架构师面试,你会怎么回答?
- leetcode 第17-19题