mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
34 lines
515 B
C
34 lines
515 B
C
|
#include <stdio.h>
|
||
|
|
||
|
struct node {
|
||
|
char name[105];
|
||
|
int age;
|
||
|
};
|
||
|
|
||
|
int n, k, flag;
|
||
|
struct node stu[105];
|
||
|
|
||
|
int main() {
|
||
|
scanf("%d", &n);
|
||
|
|
||
|
for (int i = 0; i < n; i++) {
|
||
|
scanf("%s %d", stu[i].name, &stu[i].age);
|
||
|
}
|
||
|
|
||
|
scanf("%d", &k);
|
||
|
|
||
|
for (int i = 0; i < n; i++) {
|
||
|
if (stu[i].age != k) {
|
||
|
if (flag == 1) {
|
||
|
printf(" ");
|
||
|
} else {
|
||
|
flag = 1;
|
||
|
}
|
||
|
|
||
|
printf("%s", stu[i].name);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|