ZOJ Problem Set - 1188 DNA Sorting
来源:互联网 发布:linux创建文件目录 编辑:程序博客网 时间:2024/05/29 08:07
#include <iostream>#include <vector>#include <algorithm>using namespace std;bool comp (const string &s1, const string &s2);int main (){vector<string> vec;int block , n , m;string s;cin>>block;while (block--){cin>>n>>m;while (m--){cin>>s;vec.push_back(s);}sort(vec.begin() , vec.end() , comp);vector<string>::iterator it;for (it = vec.begin(); it != vec.end(); it++){cout<<*it<<endl;}/*for (int i = 0; i < vec.size(); i++) //用下标的方式输出,但是要注意使用vec.size(),否则会出现问题 {cout<<vec[i]<<endl;}*/if (block) cout<<endl;vec.clear();}return 0;}bool comp (const string &s1 , const string &s2){int c1 = 0 , c2 = 0;for (int i = 0; i < s1.size(); i++){for (int j = i + 1; j < s1.size(); j++){if (s1[i] > s1[j]) c1++;if (s2[i] > s2[j]) c2++;}}return c1<c2;}
0 0
- ZOJ Problem Set - 1188 DNA Sorting
- ZOJ Problem Set - 1188 DNA Sorting
- ZOJ 1188 DNA Sorting
- ZOJ 1188 DNA Sorting
- zoj 1188 DNA Sorting
- zoj 1188 - DNA Sorting
- ZOJ Problem Set - 1171 Sorting the Photos
- Solution of ZOJ 1188 DNA Sorting
- zoj 1188 DNA Sorting(STL)
- zoj 1188.DNA Sorting
- ZOJ Problem Set - 1060 Sorting It All Out
- Problem E-5 DNA sorting
- zoj 1188 || poj 1007 DNA Sorting(水~)
- ZOJ Problem Set - 2060
- ZOJ Problem Set - 2972
- ZOJ Problem Set - 1037
- ZOJ Problem Set - 1048
- ZOJ Problem Set - 1049
- 错误 1 error C2065: "endl": 未声明的标识符
- Java - 基础增强 - 增强for - 可变参数 - 枚举 - 反射 - 内省 - 泛型
- 自我反省(一)
- poj-2140
- 你为你的机会准备了什么
- ZOJ Problem Set - 1188 DNA Sorting
- 判断子序列、求最长公共子序列算法实现
- tomcat 卡死 Initializing Spring root WebApplicationContext
- Xcode6编译SDWebImage报错解决方法(SDWebImageDownloaderOperation.m错误)
- HDU 2.1.1最小公倍数
- sdut 3-1 Point类的构造函数
- 美团二面经验
- 输入两个整数n和m, 从数列1,2,...,n中任意选择几个数,使其和等于m, 要求编写程序输出所有的组合
- an android virtual device that failed to load 安卓虚拟机无法启动