UVA 10391 stl
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的更多相关文章
- UVa 10391 (水题 STL) Compound Words
今天下午略感无聊啊,切点水题打发打发时间,=_=|| 把所有字符串插入到一个set中去,然后对于每个字符串S,枚举所有可能的拆分组合S = A + B,看看A和B是否都在set中,是的话说明S就是一个 ...
- 复合词(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 ...
- UVA 11997 STL 优先队列
题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...
- UVA 11995 STL 使用
There is a bag-like data structure, supporting two operations: 1 x Throw an element x into the bag. ...
- UVA 10391 - Compound Words 字符串hash
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- UVA 540 stl
Queues and Priority Queues are data structures which are known to most computer scientists. The Team ...
- UVa 10763 (STL) Foreign Exchange
看到大神说location的值不会超过1000,所以这就简单很多了,用一个deg数组记录下来每个点的度,出度-1,入读+1这样. 最后判断每个点的度是否为0即可. 至于为什么会这样,据说是套数据套出来 ...
- UVa 12096 (STL) The SetStack Computer
题意: 有一个集合栈计算机,栈中的元素全部是集合,还有一些相关的操作.输出每次操作后栈顶集合元素的个数. 分析: 这个题感觉有点抽象,集合还能套集合,倒是和题中配的套娃那个图很贴切. 把集合映射成ID ...
- UVa 221 (STL 离散化) Urban Elevations
题意: 作图为n个建筑物的俯视图,右图为从南向北看的正视图,按从左往右的顺序输出可见建筑物的标号. 分析: 题中已经说了,要么x相同,要么x相差足够大,不会出现精度问题. 给这n个建筑物从左往右排序, ...
随机推荐
- java常用方法总结
最近打算换工作,还是需要补一下面试的基础知识,写了一些面试中可能会用到的常用算法.方法,以便复习 //99乘法表 /** * 1*1 * 1*1 1*2 * 1*1 1*2 1*3 * …… * */ ...
- notepad++下的字体设置
设置 - 语言格式设置 中
- leetcode - Merge Sorted Array (run time beats 100.00% of cpp submissions.)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode ...
- Android组件系列----Android Service组件深入解析
[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...
- Android service ( 一 ) 三种开启服务方法
一. Service简介 Service是android 系统中的四大组件之一(Activity.Service.BroadcastReceiver.ContentProvider),它跟 Activ ...
- 我的WCF摸爬滚打之路(1)
等了好久终于等到今天!盼了好久终于把梦实现……哈哈,仅以此歌词来庆祝我为期3天的wcf学习之路圆满结束. 今天写这个文章的目的在于记录一下我自己在学习WCF的时候碰到的一些问题,俗话说,好记心不如烂笔 ...
- C#中的Decimal类型
这种类型又称财务类型,起源于有效数字问题.FLOAT 单精度,有效数字7位.有效数字是整数部分和小数部分加起来一共多少位.当使用科学计数法的,FLOAT型会出现很严重的错误.比如 8773234578 ...
- C# 版本的 计时器类:精确到微秒 秒后保留一位小数 支持年月日时分秒带单位的输出
class TimeCount { // 临时变量,存放当前类能表示的最大年份值 ; /// <summary> /// 获取毫秒能表示的最大年份数 /// </summary> ...
- php基础15:表单验证
<?php $nameError=$emailError=$genderError=$websiteError=""; $name=$email=$gender=$comme ...
- Jquery 将表单序列化为Json对象
大家知道Jquery中有serialize方法,可以将表单序列化为一个“&”连接的字符串,但却没有提供序列化为Json的方法.不过,我们可以写一个插件实现. 我在网上看到有人用替换的方法,先用 ...