原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1113

字符串简单题:

stl水过

如下:

 #include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<map>
#include<set>
using std::set;
using std::map;
using std::sort;
using std::string;
using std::next_permutation;
set<string> rec;
int _main(){
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w+", stdout);
#endif
int c = ;
char buf[], tmp[];
while (~scanf("%s", buf) && c != ){
if (!c && strcmp(buf, "XXXXXX") != ) rec.insert(buf);
else if ( == strcmp(buf, "XXXXXX")) c++;
else {
int flag = , n = strlen(buf);
strcpy(tmp, buf);
sort(tmp, tmp + n);
do{
if (rec.count(tmp) != ) flag = , printf("%s\n", tmp);
} while (next_permutation(tmp, tmp + n));
if (!flag) printf("NOT A VALID WORD\n", tmp);
printf("******\n");
}
}
return ;
}

hdu 1113 Word Amalgamation的更多相关文章

  1. hdu 1113 Word Amalgamation 解题报告

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1113 题意:输入一个字典,然后再输入若干单词(每行中,1 <= 单词数 <= 100,并且 ...

  2. hdu - 1113 Word Amalgamation (stl)

    http://acm.hdu.edu.cn/showproblem.php?pid=1113 给定一个字典,然后每次输入一个字符串问字典中是否有单词与给定的字符串的所有字母一样(顺序可以打乱),按字典 ...

  3. HDU 1113 Word Amalgamation (map 容器 + string容器)

    http://acm.hdu.edu.cn/showproblem.php?pid=1113 Problem Description In millions of newspapers across ...

  4. HDOJ/HDU 1113 Word Amalgamation(字典顺序~Map)

    Problem Description In millions of newspapers across the United States there is a word game called J ...

  5. HDOJ.1113 Word Amalgamation(map)

    Word Amalgamation 点我挑战题目 点我一起学习STL-MAP 题意分析 给出字典.之后给出一系列======乱序======单词,要求你查字典,如过这个乱序单词对用有多个有序单词可以输 ...

  6. hdu1113 Word Amalgamation(详解--map和string的运用)

    版权声明:本文为博主原创文章.未经博主同意不得转载. vasttian https://blog.csdn.net/u012860063/article/details/35338617 转载请注明出 ...

  7. Word Amalgamation(枚举 + 排序)

    Word Amalgamation Time Limit: 1 Sec  Memory Limit: 64 MB Submit: 373  Solved: 247 Description In mil ...

  8. hdu-----(1113)Word Amalgamation(字符串排序)

    Word Amalgamation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  9. Word Amalgamation(hdoj1113)

    Word Amalgamation Problem Description In millions of newspapers across the United States there is a ...

随机推荐

  1. Class diagrams

    So far we have seen stack diagrams, which show the state of a program, and object diagrams, which sh ...

  2. Devexpress中WebChartControl控件柱状统计图的做法(数据为调用存储过程)

    //前台控件代码:WebChartControl控件: <%-- 月采购量统计--%> <dxchartsui:WebChartControl ID="WebChartCo ...

  3. CSS3之阴影

    CSS3中新增属性-阴影,可以做出很多漂亮的效果. 文字阴影text-shadow text-shadow属性值的顺序: text-shadow: h-shadow v-shadow blur col ...

  4. JS判断对象是否存在的方法

    Javascript语言的设计不够严谨,很多地方一不小心就会出错. 举例来说,请考虑以下情况. 现在,我们要判断一个全局对象myObj是否存在,如果不存在,就对它进行声明.用自然语言描述的算法如下: ...

  5. @service中构造方法报错

    因为类首先被Spring实例化的时候,会调用构造函数.只有实例化后,才会注入.你等于没注入就调用了,所以报错.

  6. docker学习(二)

    1 镜像 docker使用联合加载技术,一次同时加载多个文件系统,在外面只能看到一个文件系统 docker使用写时复制,每个只读镜像层都是只读的,也永远不会发生变化,建立一个新容器,会构建一个镜像栈, ...

  7. SVN 记录冲突、忽略

    之前对SVN不熟悉,一碰到冲突就怕得要死,不知道应该怎么处理.今天必须要正视这个问题,研究一下. 一.冲突 SVN非常智能,它不像VSS那样,一个人在改的时候必须以独占的方式签出文件,导致其他人不能够 ...

  8. docker1.12 安装redis第三方集群方案 codis

    docker1.12 安装redis第三方集群方案 codis

  9. asp.net常用字符串函数

    /// <summary> /// 提取字符串中的数字 /// </summary> /// <param name="str"></pa ...

  10. JS产生四位随机数的方法

    <script>var charactors="1234567890"; var value='',i; for(j=1;j<=4;j++){ i = parse ...