poj 1318 Word Amalgamation
| Time Limit: 1000MS | Memory Limit: 10000K | |
| Total Submissions: 9968 | Accepted: 4774 |
Description
Input
Output
Sample Input
tarp
given
score
refund
only
trap
work
earn
course
pepper
part
XXXXXX
resco
nfudre
aptr
sett
oresuc
XXXXXX
Sample Output
score
******
refund
******
part
tarp
trap
******
NOT A VALID WORD
******
course
****** 题意:用XXXXXX表示文本输入部分结束和查询部分结束;如果如果查询的一个单词和输入的单词字母组成一样;输出文本部分所用符合的单词;每查询一次输出*******分隔 题解:一个单词不管怎么排列,经过排序之后的形式一定是一样的,用排序之后的单词作为键值,用map匹配
#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<map>
#include<set>
#define ll long long
using namespace std;
map<string,string>m;
string s,ss;
int n;
int main()
{
int flag=;
while(flag!=)
{
cin>>s;
if(s[]=='X')
{
flag++;
continue;
}
if(flag==)
{
ss=s;
sort(ss.begin(),ss.end());
m[s]=ss; }
if(flag==)
{
int flag2=;
sort(s.begin(),s.end());
map<string,string>::iterator it;
for(it=m.begin();it!=m.end();it++)
{
if(it->second==s)
{
flag2=;
cout<<it->first<<endl;
}
}
if(flag2==)
cout<<"NOT A VALID WORD"<<endl;
cout<<"******"<<endl;
}
} return ; }
poj 1318 Word Amalgamation的更多相关文章
- Word Amalgamation(枚举 + 排序)
Word Amalgamation Time Limit: 1 Sec Memory Limit: 64 MB Submit: 373 Solved: 247 Description In mil ...
- hdu-----(1113)Word Amalgamation(字符串排序)
Word Amalgamation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- Word Amalgamation(hdoj1113)
Word Amalgamation Problem Description In millions of newspapers across the United States there is a ...
- hdu1113 Word Amalgamation(详解--map和string的运用)
版权声明:本文为博主原创文章.未经博主同意不得转载. vasttian https://blog.csdn.net/u012860063/article/details/35338617 转载请注明出 ...
- HDOJ.1113 Word Amalgamation(map)
Word Amalgamation 点我挑战题目 点我一起学习STL-MAP 题意分析 给出字典.之后给出一系列======乱序======单词,要求你查字典,如过这个乱序单词对用有多个有序单词可以输 ...
- poj1318 Word Amalgamation 字符串排序(qsort)
Word Amalgamation Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9794 Accepted: 4701 ...
- Uva 642 - Word Amalgamation sort qsort
Word Amalgamation In millions of newspapers across the United States there is a word game called J ...
- poj 1318
http://poj.org/problem?id=1318 这个题目还是比较水的,不过也可以提升你对字符串的熟悉度以及对一些排序函数和字符函数的使用. 大概的题意就是给你一个字典,这个字典有一些单词 ...
- Word Amalgamation
Problem Description In millions of newspapers across the United States there is a word game called J ...
随机推荐
- C++查找指定路径下的特定类型的文件
转载:https://www.cnblogs.com/tinaluo/p/6824674.html 例子:找到C盘中所有后缀为exe的文件(不包括文件夹下的exe文件) #include<std ...
- IP show
1. 查看本机公网IP 1.1 curl ifconfig.me 1.2 ipinfo.io 1.3 test-ipv6.com 1.4 more 2. 查看本机IP,host 2.1 hostnam ...
- Write-up-NODE-1
关于 下载地址:点我 哔哩哔哩:哔哩哔哩 一天研究OBS终于不闪屏了 顺便在这里记录一下,上网查了很久.刚刚开始是不闪屏了,但是锁屏后就唤醒不了了,只能强制关机. 然后又上网找了很久,重启了N次,终于 ...
- 解决Missing artifact com.microsoft.sqlserver:sqljdbc4:jar:4.0问题
当我们项目中用到的数据库为sql server时 我们一般在maven项目的pom.xml只添加依赖: <dependency> <groupId>com.micros ...
- JAVA版StarDict星际译王简单实现
由胡正开发的星际译王是Linux平台上很强大的一个开源的翻译软件(也有Windows版本的)支持多种词库.多种语言版本.尤其词库设计比较合理.之前看到一篇博文<星际译王词库应用-自制英汉词典&g ...
- python的init函数里参数的作用
问题发现 一直有一个疑问,有时我们在继承时,在__init__函数会出现可变参数*arg或关键字参数**kw这样的参数,这些参数有什么用?如果有用,这些参数时如何传递?传递些什么? 注:如果你不知道什 ...
- vue导航守卫和axios拦截器的区别
在Vue项目中,有两种用户登录状态判断并处理的情况,分别为:导航守卫和axios拦截器. 一.什么是导航守卫? vue-router 提供的导航守卫主要用来通过跳转或取消的方式守卫导航.(在路由跳转时 ...
- 单页面应用程序(SPA)的优缺点
我们通常所说的单页面应用程序通常通过前端框架(angular.react.vue)进行开发,单页面应用程序将所有的活动局限于一个Web页面中,仅在该Web页面初始化时加载相应的HTML.JavaScr ...
- 吴裕雄--天生自然MySQL学习笔记:MySQL 安装
所有平台的 MySQL 下载地址为: MySQL 下载:https://dev.mysql.com/downloads/mysql/ 注意:安装过程我们需要通过开启管理员权限来安装,否则会由于权限不足 ...
- Linux-使用之vim编译安装出现的问题
---恢复内容开始--- cd <directory> Short for "change directory". The shorthand name for the ...