因为数组个数必须常量的原因,基本不想靠数组解决
#include<stdio.h> int main() { int n = 0; int score = 0, max = 0, min = 100; scanf("%d",&n); while(n--) { scanf("%d",&score); if(score > max) max = score; if(score < min) min = score; } printf("%d\n",max - min); return 0; }