简单.STL
来源:互联网 发布:mac系统怎么更新不了 编辑:程序博客网 时间:2024/05/22 15:00
题目大意:给出母串,有n个字串,乱序后重新排列并输出。
解题思路:用map。
#include<iostream>#include<sstream>#include<algorithm>#include<cstdio>#include<string.h>#include<cctype>#include<string>#include<cmath>#include<vector>#include<stack>#include<queue>#include<map>#include<set>using namespace std;int main(){ int t; cin>>t; int ca=1; while(t--) { int n,m; cin>>n>>m; string str,str2; map<string,string>cnt; for(int i=0; i<n; i++) { cin>>str; str2=str; sort(str.begin(),str.end()); cnt[str]=str2; } vector<string>dict[1000]; cin.get(); for(int i=0; i<m; i++) { while(1) { cin>>str; dict[i].push_back(str); char ch=cin.get(); if(ch=='\n')break; } } printf("Case #%d:\n",ca++); int i,j; for(i=0; i<m; i++) { for(j=0; j<dict[i].size(); j++) { sort(dict[i][j].begin(),dict[i][j].end()); if(j==dict[i].size()-1) { cout<<cnt[dict[i][j]]<<endl; break; } cout<<cnt[dict[i][j]]<<" "; } } } return 0;}
0 0
- 简单.STL
- 简单STL
- stl 简单例子
- STL的简单应用
- STL简单讲解
- stl复习 简单代码
- STL 简单描述
- STL简单学习
- STL - for_each 简单应用
- STL heap简单应用
- stl 用法简单实例
- STL stack简单使用
- STL queue简单使用
- STL deque简单使用
- STL set简单使用
- stl 简单测试代码
- STL简单构成
- STL---简单整理
- AC自动机
- HTTP协议状态码详解
- Java中String类创建对象内存分析
- 第三周项目4:穷举法解决组合问题(1)
- Leet Code OJ 1. Two Sum [Difficulty: Easy]
- 简单.STL
- Hadoop 完全分布式ssh免密码设置
- 自定义View事件拦截机制(自定义viewGroup和外部法解决滑动冲突)
- 【leetcode】第11题:Container问题
- mapreduce原理和执行过程
- iOS UIViewController的生命周期及iOS程序执行顺序
- MYSQL查询优化
- 用css写出横向导航栏
- 使用MIC进行变量选择