ZOJ1181 Word Amalgamation 字符串 排序查找
来源:互联网 发布:信息技术考试软件 编辑:程序博客网 时间:2024/06/05 21:50
传送门:ZOJ1181
思路:自身排序来判断两个字符串拥有相同的字符。
#include<cstdio>#include<cstdlib>#include<iostream>#include<cstring>#include<string>#include<cmath>#include<memory.h>#include<algorithm>using namespace std;string dic[110];string sedic[110];string x;string six(6,'X');bool cmp(string a,string b){return a<b;}int main(){int num=0,i,j;while(cin>>x){if(x==six) break;dic[++num]=x;}sort(dic+1,dic+num+1,cmp);for(i=1;i<=num;i++){sedic[i]=dic[i]; sort(sedic[i].begin(),sedic[i].end());}while(cin>>x){if(x==six) return 0;bool cnt=false;sort(x.begin(),x.end());for(i=1;i<=num;i++) if(x==sedic[i]) {cnt=true;cout<<dic[i];cout<<endl; } if(!cnt) cout<<"NOT A VALID WORD"<<endl; cout<<"******"<<endl;}return 0;}
阅读全文
0 0
- ZOJ1181 Word Amalgamation 字符串 排序查找
- HDU1113 POJ1318 UVA642 ZOJ1181 Word Amalgamation
- UVa 642 Word Amalgamation (查字典&字符串排序)
- HDU 1113 Word Amalgamation -- 字符串处理+排序
- POJ 1318 Word Amalgamation (字符串 STL大水)
- ACM--字符串--HDOJ 1113--Word Amalgamation--map
- HDU 1113 Word Amalgamation(字符串&&STL)
- hdoj 1113 Word Amalgamation (字符串处理)
- Word Amalgamation
- Word Amalgamation
- Word Amalgamation
- POJ 题目1318 Word Amalgamation(排序,水)
- hdu 1113 Word Amalgamation 字符串处理 ,加上哈希 ,水题~
- Word Amalgamation源程序
- fjnu 1147 Word Amalgamation
- POJ1318 Word Amalgamation
- POJ 1318 Word Amalgamation
- ZOJ 1181Word Amalgamation
- C++ 多态
- 99乘法表
- 3Sum Closest
- 【云栖精选7月刊】抛开晦涩的算法、模型_让我们来谈谈互联网架构
- java.lang.OutOfMemoryError异常解决方法
- ZOJ1181 Word Amalgamation 字符串 排序查找
- 深入理解javascript原型和闭包(2)——函数和对象的关系
- MySQL优化的一些建议
- 解决The current branch is not configured for pull No value for key branch.master.merge found in config
- 在Spring3中使用注解(@Scheduled)创建计划任务
- SQL Server查看所有表大小,所占空间
- JAVA总结(四):正则表达式匹配中文的三种方法
- Android Studio打包和gradle配置构建
- [HDU](1849)Rabbit and Grass ---Nim博弈(博弈)