Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include "stdio.h"
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. struct SInfo
  7. {
  8. string name;
  9. int sum;
  10. };
  11.  
  12. int main()
  13. {
  14. freopen("input.txt", "r", stdin);
  15. freopen("output.txt", "w", stdout);
  16.  
  17. int i, k, N, mark, max;
  18. string fio, name;
  19.  
  20. SInfo Info[250];
  21. cin >> N;
  22.  
  23. for (int i = 0; i<N; i++)
  24. Info[i].sum = 0;
  25.  
  26. for (int i = 0; i<N; i++)
  27. {
  28. cin >> fio >> name;
  29. Info[i].name = fio + " " + name;
  30. for (int j = 0; j<3; j++)
  31. {
  32. cin >> mark;
  33. Info[i].sum += mark;
  34. }
  35. }
  36. max = Info[0].sum;
  37. for (int i = 0; i<N; i++)
  38. {
  39. if (Info[i].sum > max)
  40. max = Info[i].sum;
  41. }
  42. for (int i = 0; i<N; i++)
  43. {
  44. if (Info[i].sum == max)
  45. cout << Info[i].name<<endl;
  46. }
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement