原题链接: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. 普通session vs MemcachedSession vs RedisSession

    一.普通session(数据存储在内存中) #!/usr/bin/env python # -*- coding:utf-8 -*- from hashlib import sha1 import o ...

  2. 使用UI Automation实现自动化测试 --工具使用

    当前项目进行三个多月了,好久也没有写日志了:空下点时间,补写下N久没写的日志 介绍下两个工具 我本人正常使用的UISpy.exe工具和inspect.exe工具 这是UISPY工具使用的图,正常使用到 ...

  3. oracle:jdbcTest

    JDBC连接数据库 •创建一个以JDBC连接数据库的程序,包含7个步骤: 1.加载JDBC驱动程序: 在连接数据库之前,首先要加载想要连接的数据库的驱动到JVM(Java虚拟机), 这通过java.l ...

  4. 安全终止MFC线程

    终止线程 有两种情况可以使线程结束:控制函数结束或者根本就不允许线程完成,而提前终止它.我们可以想象在WORD中进行后台打印,如果打印结束了,那线程就可以结束了.如果用户中止了打印,那后台打印线程也要 ...

  5. kickstart bonding安装

    bonding用的是最简单的负载均衡模式,交换机不需要做配置. https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Lin ...

  6. 【好文要转】Python:模拟登录以获取新浪微博OAuth的code参数值

    [转自]http://www.tuicool.com/articles/zAz6zi [原文]http://blog.segmentfault.com/hongfei/1190000000343851 ...

  7. poj2503 哈希

    这题目主要是难在字符串处理这块. #include <stdio.h> #include <string.h> #include <stdlib.h> #defin ...

  8. protobuf的使用

    Protobuf的安装 正确安装方法: [http://blog.csdn.net/guoyilongedu/article/details/17093811] linux下安装protobuf教程+ ...

  9. 使用Visual Studio Code开发Asp.Net Core WebApi学习笔记(五)-- Filter

    在上一篇里,介绍了中间件的相关内容和使用方法.本篇将介绍Asp.Net Core MVC框架的过滤器的相关内容和使用方法,并简单说明一下与中间件的区别. 第一部分.MVC框架内置过滤器 下图展示了As ...

  10. SQL语句统计一段时间内的记录数

    实际应用中经常需要统计单位时间的记录数: 一个小时: SELECT ),createdate,) AS 日期 ,DATEPART(hh,createdate) AS 小时,COUNT(*)AS 记录 ...