//测试用例有个错的,没有进位,应该是59.10才对 #include "stdio.h" int main(){ double array[12]; while (scanf("%lf",&array[0])!=EOF){ double sum = array[0]; for (int i = 1; i < 12; ++i) { scanf("%lf",array+i); sum += array[i]; } double average = sum/12; // average = average*1000; //最后的解决进位问题 // if(int(average)%10 >= 5) // average = int(average)/10+1; // else // average = int(average)/10; // average = average/100; printf("$%.2lf\n",average); } }