这个题,单纯做出来有很多种方法,但是时间限制3000ms,因此被TL了不知道多少次,关键还是找对最优解决方法,代码附上;

#include<bits/stdc++.h>
using namespace std;
map<string,int>MAP;
char s[][]; int main(){
MAP.clear();
int n = ;
while(cin>>s[n]){ MAP[s[n]]=;
n++;
}
for(int i=;i<n;i++){
int l=strlen(s[i]); for(int j= ;j<l;j++){
char temp1[] = {'\0'};
char temp2[] = {'\0'};
strncpy(temp1,s[i],j);
strncpy(temp2,s[i]+j,l-j);
if(MAP[temp1]&&MAP[temp2])
{cout<<s[i]<<endl;
break;}
} }
return ; }

uva 10391的更多相关文章

  1. UVA 10391 stl

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

  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) Compound Words

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

  4. uva 10391 Compound Words <set>

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

  5. UVA 10391 Compound Words

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

  6. 复合词 (Compund Word,UVa 10391)

    题目描述: 题目思路: 用map保存所有单词赋键值1,拆分单词,用map检查是否都为1,即为复合词 #include <iostream> #include <string> ...

  7. 复合词(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 ...

  8. 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 ...

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

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

随机推荐

  1. WlMAP:突破内网端口转发映射工具

    使用说明 Wlmap包括服务端程序和客户端程序两部分 服务端程序Wlmaps一般架设到其它用户可以访问到的地方例如internet,它主要用来记录客户端信息以及端口映射信息,并且转发用户和客户端之间数 ...

  2. 【详细资料】ICN6211:MIPI DSI转RGB芯片简介

    ICN6211功能MIPI DSI转RGB,分辨率1920*1200,封装QFN48

  3. Java类加载原理解析

    详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt229 2       Java虚拟机类加载器结构简述 2.1    JVM三 ...

  4. B树及B+树

    详见: http://blog.yemou.net/article/query/info/tytfjhfascvhzxcytp80 B树及B+树 一.B树 1.B树的定义    B树是一种平衡的多分树 ...

  5. Push or Pull?

    采用Pull模型还是Push模型是很多中间件都会面临的一个问题.消息中间件.配置管理中心等都会需要考虑Client和Server之间的交互采用哪种模型: 服务端主动推送数据给客户端? 客户端主动从服务 ...

  6. RAID RAID 大揭秘~

    p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm; margin-bottom: .0001pt; text-align: justify; f ...

  7. 电商Banner设计背后的12个人性的秘密

  8. sublime编辑器代码背景刺眼怎么修改?

    有些人觉得如上图大括号刺眼,怎么把它改得不那么刺眼呢? [第一步]打开Bracket Hightlighter插件的用户配置文件: 然后按ctrl+G跳转到第330行, 如图位置改为"sty ...

  9. 英语app分析

    Andorid 版本 第一部分 调研, 评测 搜索了一下必应跑出来的是微软必应,在印象中微软的产品都是很可靠地.安装之后对它的 排版字体图片等不是很喜欢,感觉有道词典会更亲切一点. 必应       ...

  10. 201521123105《jave程序》第二周学习总结

    1. 本周学习总结 学习了各种java数据类型以及各种运算符的使用 学习了一维,二维数组的用法 学习了String类对象使用 2. 书面作业 使用Eclipse关联jdk源代码,并查看String对象 ...