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

#include<iostream>
#include<stdio.h>
#include<string.h>
#include<string>
#include<map>
using namespace std;
string ss;
char s[][];
int main()
{
int i,j;
i=;
map<string,int>Map;
while()
{
gets(s[i]);
if(strcmp(s[i],"")==)
break;
int len=strlen(s[i]);
ss="";
for(j=;j<len;j++)
{
ss+=s[i][j];
}
Map[ss]=;
i++;
}
int l=i;
string s1,s2;
for(i=;i<l;i++)
{
s1="";
int fl=strlen(s[i]);
for(j=;j<fl;j++)
{
s1+=s[i][j];
s2="";
for(int k=j+;k<fl;k++)
{
s2+=s[i][k];
}
if(Map[s1]==&&Map[s2]==)
{
printf("%s\n",s[i]);
break;
}
}
}
}

UVA 10391 stl的更多相关文章

  1. UVa 10391 (水题 STL) Compound Words

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

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

  3. UVA 11997 STL 优先队列

    题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  4. UVA 11995 STL 使用

    There is a bag-like data structure, supporting two operations: 1 x Throw an element x into the bag. ...

  5. UVA 10391 - Compound Words 字符串hash

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

  6. UVA 540 stl

    Queues and Priority Queues are data structures which are known to most computer scientists. The Team ...

  7. UVa 10763 (STL) Foreign Exchange

    看到大神说location的值不会超过1000,所以这就简单很多了,用一个deg数组记录下来每个点的度,出度-1,入读+1这样. 最后判断每个点的度是否为0即可. 至于为什么会这样,据说是套数据套出来 ...

  8. UVa 12096 (STL) The SetStack Computer

    题意: 有一个集合栈计算机,栈中的元素全部是集合,还有一些相关的操作.输出每次操作后栈顶集合元素的个数. 分析: 这个题感觉有点抽象,集合还能套集合,倒是和题中配的套娃那个图很贴切. 把集合映射成ID ...

  9. UVa 221 (STL 离散化) Urban Elevations

    题意: 作图为n个建筑物的俯视图,右图为从南向北看的正视图,按从左往右的顺序输出可见建筑物的标号. 分析: 题中已经说了,要么x相同,要么x相差足够大,不会出现精度问题. 给这n个建筑物从左往右排序, ...

随机推荐

  1. FZU 2150 Fire Game --两点同步搜索

    枚举两点,然后同步BFS,看代码吧,很容易懂的. 代码: #include <iostream> #include <cstdio> #include <cstring& ...

  2. Windows远程连接MAC桌面

    一.准备软件 VNC Server (MAC OS X已支持) RealVNC/TightVNC 二.MAC OS X设置 注:Mac OS X 10.5 已经支持了VNC Viewer访问的功能,设 ...

  3. Swift中的Masonry第三方库——SnapKit

        在OC开发时我常用一个名叫Masonry的第三方Autolayout库,在转Swift后发现虽然Swift可以混编OC,但总感觉有些麻烦,在Github上发现了这个叫做SnapKit的第三方库 ...

  4. mobileTech

    A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 工具类网站 HTML ...

  5. 搭建一个Web应用

    因为EasyUI会涉及到与后台数据的交互,所以使用Spring MVC作为后台,搭建一个完整的Web环境 使用gradle作为构建工具 build.gradle group 'org.zln.lkd' ...

  6. C语言 函数理解(以数组做参数)

    #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> int run(int *p){ // ...

  7. unity触发器和碰撞器

    Unity中检测碰撞的方法有两种,一种是触发器一种是碰撞器,现在我来解释一下两种的区别. 触发器:有三种方法,分别是OnTriggerEnter,OnTriggerStay,OnTriggerExit ...

  8. 模拟alert和confirm

    啥也不说,先上图,有图有真相 :) 现在绝大多数网站都不用自带的alert和confirm了,因为界面太生硬了.因此这个插件就这样产生了... 来看插件的实现代码吧: (function () { $ ...

  9. Sublime Text 2 - 性感无比的代码编辑器!程序员必备神器!跨平台支持Win/Mac/Linux

    我用过的编辑器不少,真不少- 但却没有哪款让我特别心仪的,直到我遇到了 Sublime Text 2 !如果说“神器”是我能给予一款软件最高的评价,那么我很乐意为它封上这么一个称号.它小巧绿色且速度非 ...

  10. java实现八皇后问题(递归和循环两种方式)

    循环方式: package EightQueens;   public class EightQueensNotRecursive { private static final boolean AVA ...