The education of primary school in China is a big problem now. A teacher must be very careful not only when he/she is criticizing the students, but also when he/she is giving awards to good students. Teacher Liu always gave the top ten students on his examination some little awards before, but some parents are a little bit angry about this now. They say that their little kids may get hurt because they will never get the awards. Teacher Liu has to change his award rule. He wants all students have a chance to win the awards, no matter their scores are good or poor. But he still wants good students to get more chance. So the new rule seems a little bit odd: anyone whose score equals to the sum of the scores of OTHER 3 or 2 students, will win the award. Now figuring out who is qualified for the awards seems a little bit hard for Teacher Liu. As the monitor of his class and a little programmer, you should help him to do this.
The first line is an integer T indicating the number of test cases.
For each test case, the first line is an integer N meaning the number of students. (0 < N < = 20 ) Then N lines follows, and each line contains a student’s name and score.
A student’s name is a string made up of uppercase letters(no more than 20 letters). A student’s score is an integer between 0 and 100 (could be 0 or 100).
Every student’s name is unique and every name just appears once.
For each test case, first print an integer in a line, indicating how many students win the awards. Then print the names of those who win the awards in alphabetic order, each name in a line.
#include <iostream> struct STU int hash, hash1;
using namespace std;
int score, num;
int t, i, n, k, j;
while(scanf("%d", &t) != EOF)
memset(hash, 0, sizeof(hash));
memset(hash1, 0, sizeof(hash1));
for(i = 0; i < n; i++)
cin >> s[i].name >> s[i].score;
for(i = 0; i < n; i++)
for(j = 0; j < n; j++)
if(i != j)
for(k = 0; k < n; k++)
if(i != j && i != k && j != k)
for(i = 0; i < n - 1; i++)
for(j = i + 1; j < n; j++)
int ans = s[i].score + s[j].score;
for(k = j + 1; k < n; k++)
int ans1 = s[i].score + s[j].score + s[k].score;
for(i = 0, j = 0; i < n; i++)
if(hash[s[i].score] && hash[s[i].score] > hash1[i][s[i].score])
a[j] = s[i].name;
int m = j;
sort(a, a + m);
for(i = 0; i < m; i++)
cout << a[i] << endl;
int hash, hash1;