这个题,单纯做出来有很多种方法,但是时间限制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. 简单利用HTTP中的PUT协议拿下SHELL

    第一次用方法拿shell,之前遇到的都是没有写入权限的. 站太辣鸡,纯粹练手,就不打码了. 此次实战会用到的HTTP请求方法: OPTIONS,PUT,MOVE/COPPY * 战前准备 0x01 什 ...

  2. scikit_learn入门

    原文:http://www.cnblogs.com/taceywong/p/4568806.html 原文地址:http://scikit-learn.org/stable/tutorial/basi ...

  3. Json简介1

    使用Notepad++编程: <!DOCTYPE html><html><head><meta charset="UTF-8">&l ...

  4. windows下命令行模式中cd命令无效的原因

    当我们执行cmd 想切换当前工作目录时,会发现windows下命令行模式中cd命令没有生效,到底是什么原因呢? 例如: 当我们想切换到 D:\MySql\mysql-5.7.19-winx64\bin ...

  5. 【Linux部署 · JDK】在linux系统安装jdk

    1,检查是否安装jdk   echo $JAVA_HOME 或者java -version   2,查看操作系统,很明显这是一个相当old的操作系统,i686是32位操作系统.   3,在oracle ...

  6. 即时通信系统Openfire分析之四:消息路由

    两个人的孤独 两个人的孤独,大抵是,你每发出去一句话,都要经由无数网络.由几百个计算机处理后,出在他的面前,而他就在你不远处. 连接管理之后 Openfire使用MINA网络框架,并设置Connect ...

  7. Appium环境搭建(python)

    appium是一个开源的,适用于原生或者移动网络和混合应用程序在 iOS 和 Android 平台上的的开源自动化测试框架.在这里,详细的介绍Appium的环境搭建步骤. 1.安装Node.js在ht ...

  8. SpirngMVC入门第一天

                                         SpringMVC第一天 1.   计划 第一天 1.SpringMVC介绍 2.入门程序 3.SpringMVC架构讲解 a ...

  9. HTTP协议Keep-Alive模式详解

    详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcytp22 HTTP协议Keep-Alive模式详解 1.什么是Keep-Aliv ...

  10. 基于C语言的UTF-8中英文替换密码设计

    简要说明 本设计为湖南大学密码学的一次课程作业设计.非作业目的可随意引用. 由于本人初次接触密码学,本设计可能存在问题以及漏洞.若发现望指出. GitHub : https://github.com/ ...