题目描述:

题目思路:

用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. STM32F10X固件库函数——串口清状态位函数分析

    STM32F10X固件库函数——串口清状态位函数分析 最近在测试串口热插拔功能的时候,意外发现STM32F10X的串口库函数中,清理串口状态位函数稍稍有点不解.下面是改函数的源码: /******** ...

  2. ARM v7-A 系列CPU的MMU隐射分析

    ARM v7-A 系列CPU的MMU隐射分析 摘要:ARM v7-A系列的CPU加入了很多扩展,如多核处理器扩展.大物理地址扩展.TrustZone扩展.虚拟化扩展.若支持大的物理地址,则必须支持多核 ...

  3. Address already in use

    1.错误描述 2011-7-20 11:05:18 org.apache.catalina.core.StandardServer await严重: StandardServer.await: cre ...

  4. SVN 操作报错 “Previous operation has not finished; run 'cleanup' if it was interrupted“

    今天在 通过 SVN 合并代码的时候报了如下的错误 ”Previous operation has not finished; run 'cleanup' if it was interrupted“ ...

  5. MYSQL 8.0.11 安装过程及 Navicat 链接时遇到的问题

    参考博客:https://blog.csdn.net/WinstonLau/article/details/78666423 我的系统和软件版本是这样的: 系统环境:win7.64位 MySQL版本: ...

  6. The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.报该错误的一种原因。

    今天发现某个action返回404. HTTP Status 404 – Not Found Type Status Report Message /xxx.action Description Th ...

  7. SpringBoot整合Mybatis,TypeAliases配置失败的问题

    SpringBoot整合Mybatis,TypeAliases配置失败的问题 问题描述 在应用MyBatis时,使用对象关系映射,将对象和Aliase映射起来. 在Mybatis的文档明确写出,如果你 ...

  8. Yii2之发送电子邮件

    官方文档:http://www.yiiframework.com/doc-2.0/guide-tutorial-mailing.html 使用Yii2框架的时候,有时候需要发送电子邮件,Yiii2提供 ...

  9. 离不开的微服务架构,脱不开的RPC细节(值得收藏)!!!

    服务化有什么好处? 服务化的一个好处就是,不限定服务的提供方使用什么技术选型,能够实现大公司跨团队的技术解耦,如下图所示: 服务A:欧洲团队维护,技术背景是Java 服务B:美洲团队维护,用C++实现 ...

  10. Redis(五):Redis的持久化

    Redis的持久化目录导航: 总体介绍 RDB(Redis DataBase) AOF(Append Only File) 总结(Which one) 总体介绍 官网介绍 RDB(Redis Data ...