#include #include #include using namespace std; struct echipa { int punctaj, nr, goals, lung; }; echipa v[5]; char ch, sir[101], x[10][101]; int l, ind, ind1, gasit, p1, p2; bool comp(const echipa &A, const echipa &B) { if(A.punctaj!=B.punctaj) return A.punctaj>B.punctaj; else { if(A.goals!=B.goals) return A.goals>B.goals; else { return x[B.nr]>x[A.nr]; } } } int main() { for(int i=1; i<=6; ++i) { cin.get(sir, 100, ' '); cin.get(); ind=0; for(int j=1; j<=gasit; ++j) { for(int k=0; k>p1>>p2; if(p1>p2) { v[ind].punctaj+=3; v[ind].goals+=p1; v[ind1].goals+=p2; } else if(p2>p1) { v[ind1].punctaj+=3; v[ind].goals+=p1; v[ind1].goals+=p2; } else { v[ind].punctaj+=1; v[ind1].punctaj+=1; v[ind].goals+=p1; v[ind1].goals+=p2; } cin.get(); } sort(v+1, v+5, comp); for(int i=1; i<=4; ++i) { cout<