2 2 1 10 10 11 3 1 10 10 11 11 20
1 2
AC-code:
#include<cstdio> #include<algorithm> using namespace std; struct sc { int day,score; }num[1005]; bool cmp(sc a,sc b) { if(a.day==b.day) return a.score>b.score; else return a.day<b.day; } int main() { int scanf("%d",&T); while(T--) { scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&num[i].day); for(i=0;i<n;i++) scanf("%d",&num[i].score); sort(num,num+n,cmp); } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/lin14543/article/details/47172829