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 ...
随机推荐
- jboss 7 as1 日志配置
原文地址:https://docs.jboss.org/author/display/AS71/Logging+Configuration Overview The overall server lo ...
- WebLogic: The Definitive Guide examined WebLogic's security mechanisms--reference
reference from: http://www.onjava.com/pub/a/onjava/excerpt/weblogic_chap17/index1.html?page=1 ...... ...
- 『零行代码』解决键盘遮挡问题(iOS)
关注仓库,及时获得更新:iOS-Source-Code-Analyze https://github.com/draveness/iOS-Source-Code-Analyze Follow: Dra ...
- 如何学习一门新技术-iOS开发
如何快速学习一门新技术 以CoreBluetooth 蓝牙开发为例.我们可以从官方获得的资源有:SampleCode, Documentation,API Reference. 先从Documenta ...
- 【IBM】Merlin 给 Java 平台带来了非阻塞 I/O
Merlin 给 Java 平台带来了非阻塞 I/O 新增的功能大幅降低了线程开销 Java 技术平台早就应该提供非阻塞 I/O 机制了.幸运的是,Merlin(JDK 1.4)有一根几乎在各个场合都 ...
- (转)VS2012网站发布详细步骤
2.弹出网站发布设置面板,点击<新建..>,创建新的发布配置文件: 4. 在配置中,要选择“Release”——发布模式(Release 称为发布版本,它往往是进行了各种优化,使得程序 ...
- VS2015 Cordova Ionic移动开发(五)
一.创建侧边菜单和导航项目 1.使用VS创建一个Ionic空项目,同时创建一个Ionic SideMenu和Ionic Tabs项目.将SideMenu和Tabs项目里的templates和js文件合 ...
- java中json转xml
参考:http://heipark.iteye.com/blog/1394844 需要json-lib-2.1-jdk15.jar和xom-1.2.5.jar,maven pom.xml如下: xml ...
- oracle中用comment on的用法
oracle中用comment on命令给表或字段加以说明,语法如下:COMMENT ON { TABLE [ schema. ] { table | view } | COLUMN [ s ...
- Android 官方新手指导教程
一.开始 1.建立第一个应用程序 依赖关系和先决条件 Android SDK ADT Plugin 20.0.0 或更高 (如果你使用eclipse的话) 欢迎来到Android应用程序开发! 这一节 ...