水。。。在算平均数累加的时候别忘了把一开始初始化为0,一开始因为这个WA也是菜。。。
代码:
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <cmath>
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
double d;
double total=0.0;
for(int i=0;i<12;i++)
{
scanf("%lf",&d);
total += d;
}
printf("$%.2lf\n",total*1.0/12);
//system("pause");
return 0;
}