Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. struct person
  7. {
  8. char firstname[30];
  9. char lastname[30];
  10. int math;
  11. int inf;
  12. int rus;
  13. float sr;
  14. };
  15.  
  16. int N;
  17. scanf("%d", &N);
  18. struct person info[N];
  19.  
  20. float balls = 0.0;
  21. for (int i = 0; i < N; i++)
  22. {
  23. scanf("%s", info[i].firstname);
  24. scanf("%s", info[i].lastname);
  25. scanf("%d", &info[i].math);
  26. scanf("%d", &info[i].inf);
  27. scanf("%d", &info[i].rus);
  28. info[i].sr = (info[i].math + info[i].inf + info[i].rus) / 3;
  29. balls += info[i].math + info[i].inf + info[i].rus;
  30. }
  31.  
  32. balls /= N*3;
  33. printf("%f\n", balls);
  34.  
  35. for (int i = 0; i < N; i++)
  36. {
  37. if (info[i].sr > balls)
  38. printf("%s %s\n", info[i].firstname, info[i].lastname);
  39. }
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement