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;
  9. };
  10. int n;
  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. }
  16. int M=0, F=0, I=0;
  17. for(int i=0; i<n; i++){
  18. M+=a[i].m;
  19. F+=a[i].f;
  20. I+=a[i].i;
  21.  
  22. }
  23. float sm=float(M)/n;
  24. float sf=float(F)/n;
  25. float si=float(I)/n;
  26. cout<<sm<<" "<<sf<<" "<<si<<endl;
  27. return 0;
  28. }
Success #stdin #stdout 0s 5300KB
stdin
3
Babat Anna 5 4 3
Belova Galina 4 3 5
Moroz Yaroslav 3 5 4
stdout
4 4 4