fork(1) download
  1. #include <iostream>
  2. #include <stack>
  3. using namespace std;
  4.  
  5. int main() {
  6. struct student{
  7. string fam, name;
  8. int m,f,i,s;
  9. };
  10. int n, mx;
  11. cin>>n;
  12. student a[n];
  13. for(int i=0; i<n; i++){
  14. cin>>a[i].fam>>a[i].name>>a[i].m>>a[i].f>>a[i].i;
  15. a[i].s=a[i].m+a[i].f+a[i].i;
  16. mx=max(a[i].s, mx);
  17. }
  18. for(int i = 0; i < n; i++) {
  19. if(a[i].s == mx) {
  20. cout << a[i].fam << " " << a[i].name << endl;
  21. }
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5280KB
stdin
2
Markov Valeriy 1 1 1
Sergey Petrov 5 5 5
stdout
Standard output is empty