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 0.01s 5276KB
stdin
2
Markov Valeriy 4 5 2
Kozlov Georgiy 5 1 2
stdout
4.5 3 2