#include <stdio.h>
struct student {
int bangou;
int tokuten;
int hyouka;
};
int main()
{
struct student s[10];
int i, bangou, tokuten, goukei = 0, heikin, sa, hyouka;
for (i = 0; i < 10; i++) {
scanf("%d %d", &bangou
, &tokuten
); s[i].bangou = bangou;
s[i].tokuten = tokuten;
goukei += tokuten;
}
heikin = goukei / 10;
for (i = 0; i < 10; i++) {
sa = s[i].tokuten - heikin;
if (20 <= sa) hyouka = 0;
else if (10 <= sa) hyouka = 1;
else if (0 <= sa) hyouka = 2;
else if (-20 <= sa) hyouka = 3;
else hyouka = 4;
s[i].hyouka = hyouka;
}
for (hyouka = 0; hyouka < 5; hyouka++) {
printf("\n評価:%c\n", "SABCF"[hyouka
]); for (i = 0; i < 10; i++) {
if (s[i].hyouka == hyouka) {
printf("%d %d\n", s
[i
].
bangou, s
[i
].
tokuten); }
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgpzdHJ1Y3Qgc3R1ZGVudCB7CglpbnQJYmFuZ291OwoJaW50CXRva3V0ZW47CglpbnQJaHlvdWthOwp9OwoKaW50IG1haW4oKQp7CglzdHJ1Y3Qgc3R1ZGVudCBzWzEwXTsKCWludAlpLCBiYW5nb3UsIHRva3V0ZW4sIGdvdWtlaSA9IDAsIGhlaWtpbiwgc2EsIGh5b3VrYTsKCglmb3IgKGkgPSAwOyBpIDwgMTA7IGkrKykgewoJCXNjYW5mKCIlZCAlZCIsICZiYW5nb3UsICZ0b2t1dGVuKTsKCQlzW2ldLmJhbmdvdSA9IGJhbmdvdTsKCQlzW2ldLnRva3V0ZW4gPSB0b2t1dGVuOwoJCWdvdWtlaSArPSB0b2t1dGVuOwoJfQoJaGVpa2luID0gZ291a2VpIC8gMTA7Cglmb3IgKGkgPSAwOyBpIDwgMTA7IGkrKykgewoJCXNhID0gc1tpXS50b2t1dGVuIC0gaGVpa2luOwoKCQlpZiAoMjAgPD0gc2EpIGh5b3VrYSA9IDA7CgkJZWxzZSBpZiAoMTAgPD0gc2EpIGh5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