UVa123 - Searching Quickly
题目地址:点击打开链接
C++代码:
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <cctype>
#include <cstdio>
using namespace std;
int main()
{
set<string> ignore;
string str;
multimap<string,string> ssm;
while(cin>>str&&str!="::")
ignore.insert(str);
getchar();
while(getline(cin,str))
{
int i;
for(i=0;i<str.size();++i)
str[i]=tolower(str[i]);
for(i=0;i<str.size();i++)
{
if(!isalpha(str[i]))
continue;
int j=i;
while(j<str.size()&&isalpha(str[j]))
++j;
string key_str(str,i,j-i);
if(!ignore.count(key_str))
{
for(int k=0;k<key_str.size();++k)
key_str[k]=toupper(key_str[k]);
string t(str);
t.replace(i,j-i,key_str);
ssm.insert(make_pair(key_str,t));
}
i=j;
}
}
map<string,string>::const_iterator iter=ssm.begin();
while(iter!=ssm.end())
{
cout<<iter->second<<endl;
++iter;
}
return 0;
}
UVa123 - Searching Quickly的更多相关文章
- STL --- UVA 123 Searching Quickly
UVA - 123 Searching Quickly Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.acti ...
- uva 123 Searching Quickly
Searching Quickly Background Searching and sorting are part of the theory and practice of computer ...
- 刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第五章 3(Sorting/Searching)
第一题:340 - Master-Mind Hints UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Item ...
- Volume 1. Sorting/Searching(uva)
340 - Master-Mind Hints /*读了老半天才把题读懂,读懂了题输出格式没注意,结果re了两次. 题意:先给一串数字S,然后每次给出对应相同数目的的一串数字Si,然后优先统计Si和S ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- Searching External Data in SharePoint 2010 Using Business Connectivity Services
from:http://blogs.msdn.com/b/ericwhite/archive/2010/04/28/searching-external-data-in-sharepoint-2010 ...
- Ehcache(2.9.x) - API Developer Guide, Searching a Cache
About Searching The Search API allows you to execute arbitrarily complex queries against caches. The ...
- Use Word 2010's Navigation Pane to quickly reorganize documents
Use Word 2010's Navigation Pane to quickly reorganize documents http://www.techrepublic.com/blog/mic ...
- Codeforces Round #236 (Div. 2) C. Searching for Graph(水构造)
题目大意 我们说一个无向图是 p-interesting 当且仅当这个无向图满足如下条件: 1. 该图恰有 2 * n + p 条边 2. 该图没有自环和重边 3. 该图的任意一个包含 k 个节点的子 ...
随机推荐
- LoadImage 和 BitBlt
#include <windows.h> #define WINDOWCLASS TEXT("Test") #define WNDTITLE TEXT("Te ...
- matlab 在代码中,显示错误,退出程序
使用函数error('message_id', 'message'),出现错误时函数中止运行. 参考http://www.ilovematlab.cn/thread-43261-1-1.html
- Foreman--管理PuppetClient
一. 环境: 1. server: puppetmaster+activemq+foreman1.3 server1.xxx.com(10.8.1.201) 2. client: fedora 19 ...
- 利用VC/VS的安装目录找到C/C++库函数实现的源代码
2013-07-03 20:08:57 大多开发软件的装目录下都有很多有价值的东西,比如help文档.user guide.src文件等.今天在VS的安装目录下发现了库函数的源文件,这些文件中有对所有 ...
- 【HDOJ】4328 Cut the cake
将原问题转化为求完全由1组成的最大子矩阵.挺经典的通过dp将n^3转化为n^2. /* 4328 */ #include <iostream> #include <sstream&g ...
- chinacloud大数据新闻
2015年大数据发展八大趋势 (0 篇回复) “数据很丰满,信息很骨感”:Sight Machine想用大数据的方法,打碎两者间的屏障 (0 篇回复) 百度携大数据"圈地" ...
- Unity3d插件推荐
2D_Toolkit_1.51 动画开发插件包 FingerGestures 触摸插件 ORK_Okashi_RPG_Kit Unity3D角色扮演游戏开发工具包 uScript-Visual-Scr ...
- UVa 1644 (筛素数 + 二分) Prime Gap
题意: 给出一个整数n,如果n是素数输出0,否则输出它后一个素数与前一个素数的差值. 分析: 首先用筛法把前十万个素数都筛出来,然后放到数组里.用二分找到不大于n的最大的素数的下标,如果这个素数等于n ...
- [POJ 1674] Sorting by Swapping
Sorting by Swapping Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9514 Accepted: 50 ...
- 【js】获得项目路径
var curWwwPath=window.document.location.href; //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp var pathNam ...