// kadai8-1.c
struct each_score {
int ten; //点数
int gou; //合格・不合格
};
struct SEISEKI {
char name[50];
struct each_score kokugo;
struct each_score sugaku;
};
void check_score(int borderline, struct SEISEKI *a)
{
a->kokugo.gou = (a->kokugo.ten < borderline) ? 0 : 1;
a->sugaku.gou = (a->sugaku.ten < borderline) ? 0 : 1;
}
void print_score(struct SEISEKI a)
{
char *gou[] = {"rejection","accept"};
printf("kokugo %d : %s\n", a.
kokugo.
ten, gou
[a.
kokugo.
gou]); printf("sugaku %d : %s\n", a.
sugaku.
ten, gou
[a.
sugaku.
gou]); }
int main()
{
struct SEISEKI score[3];
int i;
for (i = 0; i < 3; i++) {
scanf("%49s%d%d", score
[i
].
name, &score
[i
].
kokugo.
ten, &score
[i
].
sugaku.
ten); check_score(60, &score[i]);
}
for (i = 0; i < 3; i++) {
print_score(score[i]);
}
return 0;
}
Ly8ga2FkYWk4LTEuYwoKc3RydWN0IGVhY2hfc2NvcmUgewogICAgIGludCAgdGVuOyAgIC8v54K55pWwCiAgICAgaW50ICBnb3U7ICAgIC8v5ZCI5qC844O75LiN5ZCI5qC8Cn07CgpzdHJ1Y3QgU0VJU0VLSSB7CiAgICBjaGFyIG5hbWVbNTBdOwogICAgc3RydWN0IGVhY2hfc2NvcmUgIGtva3VnbzsKICAgIHN0cnVjdCBlYWNoX3Njb3JlICBzdWdha3U7Cn07Cgp2b2lkIGNoZWNrX3Njb3JlKGludCBib3JkZXJsaW5lLCAgc3RydWN0IFNFSVNFS0kgKmEpCnsKCWEtPmtva3Vnby5nb3UgPSAoYS0+a29rdWdvLnRlbiA8IGJvcmRlcmxpbmUpID8gMCA6IDE7CglhLT5zdWdha3UuZ291ID0gKGEtPnN1Z2FrdS50ZW4gPCBib3JkZXJsaW5lKSA/IDAgOiAxOwp9Cgp2b2lkIHByaW50X3Njb3JlKHN0cnVjdCBTRUlTRUtJIGEpCnsKCWNoYXIgKmdvdVtdID0geyJyZWplY3Rpb24iLCJhY2NlcHQifTsKCglwcmludG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