题目:http://acm.hdu.edu.cn/showproblem.php?pid=2550
#include <iostream>
#include <cstdlib>
using namespace std;
struct shot
{
int A,B;
string s;
}ca[55];
int cmp(const void *a,const void *b)
{
shot aa=*(const shot *)a;
shot bb=*(const shot *)b;
return aa.s>bb.s;
}
int main()
{
int T,n,i;
cin>>T;
while(T--)
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>ca[i].A>>ca[i].B;
ca[i].s=">+";
for(int j=0;j<ca[i].A-2;j++)
ca[i].s+='-';
ca[i].s+="+>";
}
qsort(ca,n,sizeof(ca[0]),cmp);
for(int k=0;k<n;k++)
{
for(int i=0;i<ca[k].B;i++)
cout<<ca[k].s<<endl;
cout<<endl;
}
}
return 0;
}