poj 3096 Surprising Strings
来源:互联网 发布:淘宝网商贷款扣钱 编辑:程序博客网 时间:2024/06/10 23:04
poj 3096 Surprising Strings
定义一种surprising string
如果字符数组中间隔相同的组成的两个字符集合都不一样就是surprising string 否则不是
做这题主要是为了练习map应用
一开始想的比较复杂 没构造映射对
map<string,int> mm[100] 数组中的数字枚举间隔的大小 string由两个字符组成 int表示此构成的数量 只有都是1的时候才符合要求
很好的一种想法。。
代码如下:
#include <cstdio>#include <iostream>#include <cstring>#include <cmath>#include <algorithm>#include <string.h>#include <string>#include <map>#define eps 1e-8#define op operator#define MOD 10009#define MAXN 100100#define FOR(i,a,b) for(int i=a;i<=b;i++)#define FOV(i,a,b) for(int i=a;i>=b;i--)#define REP(i,a,b) for(int i=a;i<b;i++)#define REV(i,a,b) for(int i=a-1;i>=b;i--)#define MEM(a,x) memset(a,x,sizeof a)#define ll __int64using namespace std;map < string,int > mm[100];int main(){freopen("ceshi.txt","r",stdin); char ch[100]; while(gets(ch)) { if(ch[0]=='*') break; int len=strlen(ch); bool flag=1; for(int i=1;i<len-1;i++) {// int tmp=ch[i]-'A'+1; mm[i].clear(); string s; char c[3]; for(int j=0;j+i<len;j++) { c[0]=ch[j]; c[1]=ch[j+i]; c[2]='\0'; s=c; if(mm[i][s]) {flag=0; break;} else mm[i][s]=1; } } if(flag) printf("%s is surprising.\n",ch); else printf("%s is NOT surprising.\n",ch); } return 0;}
0 0
- poj 3096 Surprising Strings
- poj 3096 Surprising Strings
- poj 3096 Surprising Strings
- poj 3096 Surprising Strings
- POJ 3096 Surprising Strings
- POJ 3096 Surprising Strings
- POJ 3096 Surprising Strings
- poj 3096 Surprising Strings
- poj 3096 Surprising Strings
- poj 3096 Surprising Strings
- POJ 3096:Surprising Strings
- Surprising Strings(POJ -3096
- poj 3096 Surprising Strings
- poj-3096-Surprising Strings
- poj 3096 Surprising Strings
- poj 3096 Surprising Strings
- POJ 3096 Surprising Strings
- poj 3096 Surprising Strings
- 【VB版机房收费】MSFlexGrid控件
- hdu 2955 Robberies(01背包)
- hdu 3874 树状数组+离线处理
- Yii 不完全解决方案(二)
- cocos2d-x ios游戏开发初认识(四) 场景的切换
- poj 3096 Surprising Strings
- hdu 1312 Red and Black(DFS)
- SlindingMenu 侧滑菜单框架使用
- STM32 关于GPIO的问题集锦
- leetcode 刷题之路 91 Pascal's Triangle
- how to access virtual machine image
- u-boot-2010.12移植到2440
- HDOJ 4944 FSF’s game
- 博客新开