struct q { char name[20]; int num; int score; }x[10005]; int cmp(q x,q y) { if(x.num!=y.num) return x.num>y.num; return x.score<y.score; } sort(x,x+n,cmp);