HDU 2093 Exam Rankings

Source: Internet
Author: User

HDU 2093 Exam Rankings

/*HDU 2093 Exam Rankings*/#include<cstdio>#include<string>#include<queue>#include<iostream>using namespacestd;structnode{stringname; intN; intUsetime; BOOL operator< (Constnode& RHS)Const {        //sort from large to small first by value from N//I remember with RHS in the way before, with the RHS of the item and the current item comparison, big on the front        if(RHS.N >N) {            return 1; }        Else if(RHS.N = =N) {            //n equality is usetime from small to large sort            if(Rhs.usetime <usetime)return 1; Else if(Rhs.usetime = =usetime) {                //sort by name from small to large when all are equal                if(Rhs.name <=name)return 1; Else                    return 0; }            Else                return 0; }        Else            return 0; }};p Riority_queue<Node>Q;intMain () {intN, M; intT, ch; scanf ("%d%d", &n, &m);    Node tmp;  while(Cin >>tmp.name) {Tmp.usetime=0; TMP.N=0; //Enter the score of n-Question         for(inti =0; I < n; ++i) {scanf ("%d", &t); if(T >0){                ++TMP.N; Tmp.usetime+=T; if(ch = getchar ()) = ='(') {scanf ("%d", &t); Tmp.usetime+ = t*m; GetChar (); //eat ') '                }            }        }//For (i)Q.push (TMP); }     while(!Q.empty ()) {tmp=q.top (); Q.pop (); printf ("%-10s%2d%4d\n", Tmp.name.c_str (), TMP.N, tmp.usetime); }    return 0;}
View Code

HDU 2093 Exam Rankings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.