题目描述:

题目思路:

用map保存所有单词赋键值1,拆分单词,用map检查是否都为1,即为复合词

 #include <iostream>
#include <string>
#include <map>
using namespace std;
map<string,int> dict ;
string str[] ;
int main(int argc, char *argv[])
{
int count = ;
while(cin >> str[count]){
dict[str[count]] = ;
count ++ ;
}
for(int i = ;i < count ;i++){
for(int j = ;j < str[i].length() ;j++){
string word1,word2 ;
word1 = str[i].substr(,j) ;
word2 = str[i].substr(j) ;
if(dict[word1] && dict[word2]) {
cout << str[i] << '\n';
break;
}
}
}
return ;
}

复合词 (Compund Word,UVa 10391)的更多相关文章

  1. 复合词(Compound Words, UVa 10391)(stl set)

    You are to find all the two-word compound words in a dictionary. A two-word compound word is a word i ...

  2. UVA 10391 - Compound Words 字符串hash

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  3. UVA 10391 stl

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  4. UVa 10391 (水题 STL) Compound Words

    今天下午略感无聊啊,切点水题打发打发时间,=_=|| 把所有字符串插入到一个set中去,然后对于每个字符串S,枚举所有可能的拆分组合S = A + B,看看A和B是否都在set中,是的话说明S就是一个 ...

  5. uva 10391 Compound Words <set>

    Compound Words You are to find all the two-word compound words in a dictionary. A two-word compound ...

  6. UVA 10391 Compound Words

    Problem E: Compound Words You are to find all the two-word compound words in a dictionary. A two-wor ...

  7. Compound Words UVA - 10391

      You are to find all the two-word compound words in a dictionary. A two-word compound word is a wor ...

  8. uva 10391

    这个题,单纯做出来有很多种方法,但是时间限制3000ms,因此被TL了不知道多少次,关键还是找对最优解决方法,代码附上: #include<bits/stdc++.h> using nam ...

  9. UVa第五章STL应用 习题((解题报告))具体!

    例题5--9 数据库 Database UVa 1592 #include<iostream> #include<stdio.h> #include<string.h&g ...

随机推荐

  1. 【题解】洛谷P1351 [NOIP2014TG] 联合权值(树形结构+DFS)

    题目来源:洛谷P1351 思路 由题意可得图为一棵树 在一棵树上距离为2的两个点有两种情况 当前点与其爷爷 当前点的两个儿子 当情况为当前点与其爷爷时比较好操作 只需要在传递时不仅传递父亲 还传递爷爷 ...

  2. WPF引用ActiveX提示没有注册类或不是有效的Win32程序

    VS2017开发WPF时,需要引用UKey组件读取插入的Ukey编号和密钥 该组件在网页端调用时使用ObjectId进行ActiveX注册即可,后来做成WPF客户端进行读取遇到该问题. 解决: 右键项 ...

  3. IE下页面左偏移并页头空出一行解决方法

    在其它浏览器下显示正常,包括360浏览器,在IE下,页面向左偏移,通过firebug查看,head标签为空,并且head标签里面的内容都跑到body标签内了,原因是有bom头,访问的页面或是加载,包含 ...

  4. Java项目排查cpu负载高

    背景 我负责的其中一个项目在空负载的情况下,CPU占用率依然保持着100%左右,线上.测试.开发的服务都一样:是什么导致的呢?在开发环境我查看了请求流量,这个流量可以忽略但CPU占用率一直在60%-1 ...

  5. Java中的IO流(四)

    上一篇<Java中的IO流(三)>把IO流中的文件及目录操作的对象File类记录了一下,本篇把本不属性IO流但又和IO流有关系的一个对象作一下记录,此对象本属于集合框架里的一个子集,即Pr ...

  6. 『ACM C++』 PTA 天梯赛练习集L1 | 048-49

    今日刷题048-049 ------------------------------------------------L1-048---------------------------------- ...

  7. table表单制作个人简历

    应用table表单,编程个人简历表单,同时运用了跨行rowspan和跨列colspan. <!DOCTYPE html> <html> <head> <met ...

  8. spring-构建mvc工程

    SpringMVC基于模型-视图-控制器(MVC)模式实现,可以构建松耦合的web应用程序. 1.SpringMVC的请求过程 1)请求离开浏览器,并携带用户所请求的内容 2)DispatcherSe ...

  9. 记一次PHP实现接收邮件信息(我这里测试的腾讯企业邮件)

    PHP实现接收邮件信息(我这里测试的腾讯企业邮件) , 其他的类型的没有测,应该只要更换pop3地址 端口号就可以. 代码如下(代码参考网络分享): <?php //此处查看链接状态 heade ...

  10. docker-compose入门示例:一键部署 Nginx+Tomcat+Mysql

    整体环境配置 整体环境的配置,如果一个一个 Dockerfile 去写,那么是相当麻烦的,好在 Docker 有一个名为 Docker-Compose 的工具提供,我们可以使用它一次性完成整体环境的配 ...