#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void search(int plist[], int num, int point)
{
int hit = 0;
int i;
for (i = 0; i < num; i++) {
if (plist[i] == point) {
printf("%d点の学生番号は%d\n", point
, i
+ 1); hit++;
}
}
if (hit <= 0) {
printf("%d点に該当する学生はいません\n", point
); }
}
int main()
{
int plist[] = {23, 40, 72, 40, 100};
int num = sizeof plist / sizeof (int);
int point;
int i;
for (i = 0; i < num; i++) {
printf("%d : %d\n", i
+ 1, plist
[i
]); }
if (scanf("%d", &point
) != 1) { return 1;
}
search(plist, num, point);
return 0;
}
I2RlZmluZSBfQ1JUX1NFQ1VSRV9OT19XQVJOSU5HUwoKI2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIHNlYXJjaChpbnQgcGxpc3RbXSwgaW50IG51bSwgaW50IHBvaW50KQp7CglpbnQgaGl0ID0gMDsKCWludCBpOwoKCWZvciAoaSA9IDA7IGkgPCBudW07IGkrKykgewoJCWlmIChwbGlzdFtpXSA9PSBwb2ludCkgewoJCQlwcmludGYoIiVk54K544Gu5a2m55Sf55Wq5Y+344GvJWRcbiIsIHBvaW50LCBpICsgMSk7CgkJCWhpdCsrOwoJCX0KCX0KCWlmIChoaXQgPD0gMCkgewoJCXByaW50ZigiJWTngrnjgavoqbLlvZPjgZnjgovlrabnlJ/jga/jgYTjgb7jgZvjgpNcbiIsIHBvaW50KTsKCX0KfQoKaW50IG1haW4oKQp7CglpbnQgcGxpc3RbXSA9IHsyMywgNDAsIDcyLCA0MCwgMTAwfTsKCWludCBudW0gPSBzaXplb2YgcGxpc3QgLyBzaXplb2YgKGludCk7CglpbnQgcG9pbnQ7CglpbnQgaTsKCglmb3IgKGkgPSAwOyBpIDwgbnVtOyBpKyspIHsKCQlwcmludGYoIiVk44CAOuOAgCVkXG4iLCBpICsgMSwgcGxpc3RbaV0pOwoJfQoKCXByaW50Zigi5L2V54K544Gu5a2m55Sf44KS5qSc57Si44GX44G+44GZ44GLP+OAgD0+Iik7CglpZiAoc2NhbmYoIiVkIiwgJnBvaW50KSAhPSAxKSB7CgkJcHJpbnRmKCLlhaXlipvjgqjjg6njg7xcbiIpOwoJCXJldHVybiAxOwoJfQoKCXNlYXJjaChwbGlzdCwgbnVtLCBwb2ludCk7CglyZXR1cm4gMDsKfQo=