【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

枚举每一个串的分割点。
看看左右两个串在不在字符串中即可。

【代码】

#include <bits/stdc++.h>
using namespace std; const int N = 12e4;
string s;
vector <string> v;
map<string, int> mmap; int main()
{
//freopen("F:\\rush.txt", "r", stdin);
ios::sync_with_stdio(0), cin.tie(0);
while (cin >> s) v.push_back(s),mmap[s] = 1;
sort(v.begin(), v.end());
int n = v.size();
for (int i = 0; i < n; i++)
{
int len = v[i].size();
for (int j = 0; j < len-1; j++)
{
string s1 = v[i].substr(0, j + 1), s2 = v[i].substr(j + 1);
if (mmap[s1] && mmap[s2])
{
cout << v[i] << endl;
break;
}
}
}
return 0;
}

【习题5-5 UVA-10391】Compound Words的更多相关文章

  1. uva 10391 Compound Words <set>

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

  2. UVA 10391 Compound Words

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

  3. UVA 10391 - Compound Words 字符串hash

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

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

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

  6. UVa 10391 (水题 STL) Compound Words

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

  7. 【UVA】10391 Compound Words(STL map)

    题目 题目     分析 自认已经很简洁了,虽说牺牲了一些效率     代码 #include <bits/stdc++.h> using namespace std; set <s ...

  8. UVA 10391 stl

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

  9. uva 10391

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

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

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

随机推荐

  1. 40.Node.js Web 模块

    转自:http://www.runoob.com/nodejs/nodejs-module-system.html 什么是 Web 服务器? Web服务器一般指网站服务器,是指驻留于因特网上某种类型计 ...

  2. AC自动机 hdu2222

    #include <iostream> using namespace std; struct Node{ Node *next[]; Node* fail; int count; Nod ...

  3. 洛谷P2251 质量检测

    题目背景 无 题目描述 为了检测生产流水线上总共N件产品的质量,我们首先给每一件产品打一个分数A表示其品质,然后统计前M件产品中质量最差的产品的分值Q[m] = min{A1, A2, ... Am} ...

  4. deep-in-es6(四)

    不定参数和默认参数: function containsAll(str) { for(var i = 1;i < arguments.length;i++) { var hasStr = arg ...

  5. 【DRF认证】

    目录 认证组件的详细用法 本文详细讲述了DRF认证组件的原理以及用法. @ * 源码剖析** 上一篇博客讲解DRF版本的时候我们都知道了,在dispatch方法里执行了initial方法来初始化我们的 ...

  6. JS原生方法被覆盖后的恢复办法

    alert 被覆盖 今天装修博客园,调试了下JS代码发现 alert() 方法被官方覆盖了,查看源码得知 alert 的功能被替换成了 console.log. 恢复 var _frame = doc ...

  7. hdu4336Card Collector 概率dp+状态压缩

    //给n个卡片每次出现的概率,求全部卡片都出现的须要抽的次数的期望 //dp[i]表示在状态的情况下到全部的卡片都出现的期望 //dp[i] = 1 + p1*dp[i] + ${p2[j]*dp[i ...

  8. Android图片处理——压缩、剪裁、圆角、保存

    点击查看原文 项目中用到的关于图片的处理 public class UtilPicture { public static final String IMAGE_UNSPECIFIED = " ...

  9. bootstrap之Orientation

    Orientation 调整屏幕方向的操作. package io.appium.android.bootstrap.handler; import android.os.RemoteExceptio ...

  10. JVM 基础知识(GC)

    几年前写过一篇关于JVM调优的文章,前段时间拿出来看了看,又添加了一些东西.突然发现,基础真的很重要.学习的过程是一个由表及里,再由里及表的过程,所谓的"温故而知新".而真正能走完 ...