Coder

舒心、快乐,比什么都重要

1004 成绩排名 (20 分)

#include <iostream>
using namespace std;
struct Stu
{
    int score;
    string id, num;
}stu;
int main(){
    string s1 ,s2 , s3, s4;
    int n, max = 0, min = 110;
    cin >> n;
    while (n--) {
        cin >> stu.id >> stu.num >> stu.score;
        if (stu.score > max){
            max = stu.score;
            s1 = stu.id;
            s2 = stu.num;
        }
        if (stu.score < min){
            min = stu.score;
            s3 = stu.id;
            s4 = stu.num;
        }
    }
    cout << s1 << ' ' << s2 << endl << s3 << ' ' << s4 << endl;
    return 0;
}

 

posted @ 2019-04-16 00:03  H123K  阅读(106)  评论(0编辑  收藏  举报