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

字符串简单题:

stl水过

如下:

  1. #include<algorithm>
  2. #include<iostream>
  3. #include<cstdlib>
  4. #include<cstring>
  5. #include<cstdio>
  6. #include<string>
  7. #include<map>
  8. #include<set>
  9. using std::set;
  10. using std::map;
  11. using std::sort;
  12. using std::string;
  13. using std::next_permutation;
  14. set<string> rec;
  15. int _main(){
  16. #ifdef LOCAL
  17. freopen("in.txt", "r", stdin);
  18. freopen("out.txt", "w+", stdout);
  19. #endif
  20. int c = ;
  21. char buf[], tmp[];
  22. while (~scanf("%s", buf) && c != ){
  23. if (!c && strcmp(buf, "XXXXXX") != ) rec.insert(buf);
  24. else if ( == strcmp(buf, "XXXXXX")) c++;
  25. else {
  26. int flag = , n = strlen(buf);
  27. strcpy(tmp, buf);
  28. sort(tmp, tmp + n);
  29. do{
  30. if (rec.count(tmp) != ) flag = , printf("%s\n", tmp);
  31. } while (next_permutation(tmp, tmp + n));
  32. if (!flag) printf("NOT A VALID WORD\n", tmp);
  33. printf("******\n");
  34. }
  35. }
  36. return ;
  37. }

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. 【LeetCode】18. 4Sum

    题目: 思路:这题和15题很像,外层再加一个循环稍作修改即可 public class Solution { public List<List<Integer>> fourSu ...

  2. matlab读取txt文档中的数据

    ps:文件中只有数字! format long fp=fopen('文件路径','打开方式(r)') [num,count]=fscnaf(fp,'%f')

  3. c语言描述简单的线性表,获取元素,删除元素,

    //定义线性表 #define MAXSIZE 20 typedef int ElemType; typedef struct { ElemType data[MAXSIZE]; //这是数组的长度, ...

  4. MySQL数据库获取多个汉字拼音的首字母函数

    需求简介:最近的一个项目,想实现如下图所示的显示效果.很明显,如果能够获取对应的汉字词组中每个汉字的拼音首字母就可以实现了,如果是固定的几组汉字,人为的拼一下就可以 了,不过项目中有多处功能需要这个效 ...

  5. 堆栈的实现(c语言)

    #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define EmptyTOS (-1) ...

  6. Json.net实现方便的Json转C#(dynamic动态类型)对象

    以前需要将一段json字符串转换为C#对象时,一般都是定义一个与之对应的实体类来接收.这样做有一个很大的缺点,就是当字符串特别长,属性特别多,又有嵌套时,手敲这个实体类就非常痛苦. 比如之前做的一个接 ...

  7. 【.NET】对文件的对称加密

    using System;using System.IO;using System.Security.Cryptography;namespace ConsoleApp_SymmetricalEncr ...

  8. webGL 学习教程

    ====教程=================== webGL中文网:http://www.hewebgl.com/webGL API:https://developer.mozilla.org/en ...

  9. JS常用的设计模式(10)——模版方法模式

    模式方法是预先定义一组算法,先把算法的不变部分抽象到父类,再将另外一些可变的步骤延迟到子类去实现.听起来有点像工厂模式( 非前面说过的简单工厂模式 ). 最大的区别是,工厂模式的意图是根据子类的实现最 ...

  10. C++记录debug信息的log类

    取自:http://www.viksoe.dk/code/all_mfc.htm,里面有各种MFC常用的类 // LogFile.h: interface for the CLogFile class ...