hdu acm2309
min需要写为1000,写成0不行。fuck,
#include <stdio.h> #include <math.h> int main(){ int n, max, min, i, num ,sum; while(~scanf("%d", &n)){ if(n==0) break; max = 0; min = 1000; sum =0; for(i=0; i<n; i++){ scanf("%d", &num); sum += num; if(max<num) max = num; if(min>num) min = num; } printf("%d\n",(sum-max-min) / (n-2)); } return 0; }
另外学了一个:
#include<math.h>
double d;
ceil(d);向上取整
floor(d);向下取整