Skip to content

Instantly share code, notes, and snippets.

@palcu
Created October 11, 2012 19:43
Show Gist options
  • Save palcu/3875013 to your computer and use it in GitHub Desktop.
Save palcu/3875013 to your computer and use it in GitHub Desktop.
Problema
#include <fstream>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
bool compara(const char x,const char y)
{
return (strcmp(&x,&y)<1);
}
int main()
{
char v[50001][11];
int i,j,k,n;
cin>>k;
for (i=0; i<k; i++) {
cin>>n;
for (j=0; j<n; j++) {
cin.get();
cin.get(v[j], sizeof(v[j]));
}
sort(v[i],v[i]+n,compara);
for (j=0; j<n; j++)
cout<<v[j]<<'\n';
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment