题解 | 最高分与最低分之差
#include <stdio.h> int main() { int a, b; scanf("%d", &a); int arr[a]; int Max = 0; int Min = 0; for (int i = 0; i < (sizeof(arr) / sizeof(arr[0])); i++) { scanf("%d", &arr[i]); } Max = arr[0]; Min = arr[0]; for (int i = 0; i < (sizeof(arr) / sizeof(arr[0])); i++) { if (arr[i] > Max) Max = arr[i]; if (arr[i] < Min) Min = arr[i]; } printf("%d", (Max - Min)); return 0; }