#include <stdio.h> int main() { struct Student { float high; char sex; } stu[5]; int i, j = 0; float s1 = 0, s2 = 0; for (i = 0; i < 5; i++) { scanf("%f%c", &stu[i].high, &stu[i].sex); if (stu[i].sex == 'm') { s1 += stu[i].high; j++; } else s2 += stu[i].high; } printf("男生平均身高%f\n女生平均身高%f\n", s1 / j, s2 / (5 - j)); return 0; }