/*
Another question
Sort () application + strcmp () application;
*/
Http://acm.hdu.edu.cn/showproblem.php? Pid = 1236 click to open the link
# Include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <cmath> # include <string> # include <iomanip> # define maxn 1005 struct student {int grade; char name [21];} stu [maxn]; int cmp (student s1, student s2) {if (s1.grade> s2.grade) return 1; if (s1.grade = s2.grade) {if (strcmp (s1.name, s2.name) =-1) return 1; elsereturn 0;} return 0;} using namespace std; int main (int argc, char * argv []) {int n, K, m, hsf-; int M_g [11]; while (scanf ("% d", & n) & n! = 0) {scanf ("% d", & m, & k); for (int I = 1; I <= m; I ++) scanf ("% d", & M_g [I]); int num, M_num; hsf-= 0; // hsf-number of people who have exceeded the score line for (int I = 0; I <n; I ++) {stu [I]. grade = 0; scanf ("% s % d", stu [I]. name, & num); for (int j = 0; j <num; j ++) {scanf ("% d", & M_num); stu [I]. grade + = M_g [M_num]; // cout <"stu" <I <":" <stu [I]. grade <endl;} if (stu [I]. grade> = k) hsf-++;} sort (stu, stu + n, cmp); // cout <"*****" <stu [1]. grade <endl; printf ("% d \ n", hsf-); for (int I = 0; I <n; I ++) {if (stu [I]. grade> = k) printf ("% s % d \ n", stu [I]. name, stu [I]. grade) ;}} return 0 ;}