Surprising Strings(map类)
http://poj.org/problem?id=3096
题意容易理解,开始直接暴力,还是用map写下吧,熟练一下;
#include<stdio.h>
#include<string.h>
#include<string>
#include<map>
using namespace std; int main()
{
char s[];
char t[];
int n,i;
map <string,int> mymap; while(~scanf("%s",s))
{
if(s[] == '*')
break; n = strlen(s);
bool flag = true;
int start,end; for(i = ; i <= n- &&flag; i++)
{
mymap.clear();
for(start = ,end = start+i+; end < n;start++,end++)
{
t[] = s[start];
t[] = s[end];
t[] = '\0';
if(mymap[t] != )
{
flag = false;
break;
}
else
mymap[t]++;
}
}
if(flag)
printf("%s is surprising.\n",s);
else printf("%s is NOT surprising.\n",s);
}
return ;
}
Surprising Strings(map类)的更多相关文章
- [ACM] POJ 3096 Surprising Strings (map使用)
Surprising Strings Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5783 Accepted: 379 ...
- [POJ3096]Surprising Strings
[POJ3096]Surprising Strings 试题描述 The D-pairs of a string of letters are the ordered pairs of letters ...
- C - Surprising Strings
C - Surprising Strings 题意:输入一段字符串,假设在同一距离下有两个字符串同样输出Not surprising ,否 ...
- HDOJ 2736 Surprising Strings
Surprising Strings Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- POJ 3096 Surprising Strings
Surprising Strings Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5081 Accepted: 333 ...
- HDU 2736 Surprising Strings
Surprising Strings Time Limit:1000MS Memory Limit:65536KB 64 ...
- 探究Java中Map类
Map以按键/数值对的形式存储数据,和数组非常相似,在数组中存在的索引,它们本身也是对象. Map的接口 Map---实现Map Map.Entry--Map的内部 ...
- 关于 Go 中 Map 类型和 Slice 类型的传递
关于 Go 中 Map 类型和 Slice 类型的传递 Map 类型 先看例子 m1: func main() { m := make(map[int]int) mdMap(m) fmt.Printl ...
- ArcGIS API for JavaScript 入门教程[5] 再讲数据——Map类之底图与高程
[回顾]前4篇交代了JsAPI的背景.资源如何获取,简介了数据与视图分离的概念与实现,剖析了页面的大骨架. 这篇开始,讲Map类. 转载注明出处,博客园/CSDN/B站/知乎:秋意正寒 目录:http ...
- Map类
Map类 方法 方法名 返回类型 说明 addLayer(layer, index?) layer 增加一个esri图层到map中,示例: var baseMapLayer = new ArcGIST ...
随机推荐
- iOS-UITableCell详情
iOS-UITableCell详情 表示UITableViewCell风格的常量有: UITableViewCellStyleDefault UITableViewCellStyleSubtitle ...
- myeclipse配置svn亲测
1.安装目录更改为myeclipse install 目录:E:\MyEclipse85\MyEclipse 8.5common 目录: E:\MyEclipse85\Common ...
- Map 迭代 两种方法
Map 迭代 两种方法 Map<String, String> map=new HashMap<String,String>(); map.put("1", ...
- poj 1821 Fence 单调队列优化dp
/* poj 1821 n*n*m 暴力*/ #include<iostream> #include<cstdio> #include<cstring> #incl ...
- enter 默认搜索
onkeydown=" if(event.keyCode==13) Search(); "
- object标签参考(转载)
<object> 元素可支持多种不同的媒介类型,比如: 图片 音频 视频 Other 对象 显示图片 你可以显示一幅图片: <object height="100%&quo ...
- linux常用编辑器
管理员在进行系统操作的时候,不可避免地会对文本进行修改,如进行各种服务程序配置文件的改动,使程序对用户提供不同的服务效果.在本章我们向大家介绍Linux上常见的编辑器ed.vi.emacs,同时以vi ...
- Spring 创建bean的模式
在默认情况下,spring创建bean是单例模式 scope="singleton ",还有一种方式为多例模式[prototype] scope sing ...
- 【HDU4366】【DFS序+分块】Successor
Problem Description Sean owns a company and he is the BOSS.The other Staff has one Superior.every st ...
- css样式积累
1.圆角: border-radius:16px 16px 16px 16px; 2透明度: filter: alpha(opacity=80); ...