【PAT】B1041 考试座位号(15 分)


/*

*/
#include<stdio.h>
#include<algorithm>
using namespace std;
struct stu{
    char number[18];
    int shi,kao;
}arr[1005];
bool cmp(stu A,stu B){
    return A.shi<B.shi;
}
int main(){
    int N,N1,temp;
    scanf("%d",&N);
    for(int i=1;i<=N;i++){
        scanf(" %s %d %d",arr[i].number,&arr[i].shi,&arr[i].kao);
    }
    sort(&arr[1],&arr[N+1],cmp);
    scanf("%d",&N1);
    for(int i=0;i<N1;i++){
        if(i!=0) printf("\n");
        scanf("%d",&temp);
        printf("%s %d",arr[temp].number,arr[temp].kao);
    }
    return  0;
}
全部评论

相关推荐

10-31 20:07
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务