Title Description:
Source:
#include "iostream" #include "string" using Namespace Std;bool isfirsthalf (string *strs, int n, string str) {int count = 0;for (int i = 0; i < n; i++) {if (str < strs[i]) count++;} Return Count >= (N/2 + n% 2);} int main () {int n, count[100], counts[5];string **strs;strs = new String*[5];for (int i = 0; i < 5; i++) {strs[i] = new St RING[100];} while (cin>>n) {if (n < 0) break;counts[1] = counts[2] = counts[3] = counts[4] = 0;for (int i = 0; i < n; i++) {cin& Gt;>count[i]>>strs[0][i];if (Count[i] > 0 && count[i] < 5) {strs[count[i]][counts[count[i]]++] = Strs[0][i];}} for (int i = 0, i < n; i++) {switch (Count[i]) {case 5:cout<<100<<endl;break;case 0:cout<<50<< Endl;break;default:if (Isfirsthalf (Strs[count[i]], counts[count[i], Strs[0][i])) {cout<<55 + ten * count[i]< <endl;} ELSE{COUT<<50 + ten * COUNT[I]<<ENDL;} Break;}} Cout<<endl;} return 0;}
HD-ACM Algorithm Specialization series (--find) your present (2)