#include <stdio.h>
#define NUM 100
int max(int grade[], int n);
int min(int grade[], int n);
int main(void)
{
int i; int j; int n, x, y; char c; char code[n][NUM]; char name[n][NUM]; int grade[i]; scanf("%d", &n); for (i = 0; i != n; i++) { for (j = 0; ((int)(c = getchar())) != 32; j++) { name[i][j] = c; } for (j = 0; ((int)(c = getchar())) != 32; j++) { code[i][j] = c; } scanf("%d", &grade[i]); } x = max(grade, n); y = min(grade, n); printf("%s %s
%s %s
", name[x], code[x],name[y], code[y]); return 0;
}
int max(int *grade, int const n)
{
int tmp; tmp = grade[0]; int i = 1; int j = 1; while (i < n) { if (grade[i] > tmp){ tmp = grade[j]; i ++; j ++; } else { i ++; j ++; } } return j;
}
int min(int *grade, int const n)
{
int tmp; tmp = grade[0]; int i = 1; int j = 1; while (i < n) { if (grade[i] < tmp){ tmp = grade[j]; i++; j++; } else { i ++; j ++; } } return j;
}
能编译不代表运行就没问题,ok?
目测有
一周热门 更多>