HDU 1064(求平均数 **)

mac2022-06-30  96

题意是求 12 个浮点数的平均数,这题不用读题,看到运行时间为 200 ms 再看下样例就能猜出题目的要求了,代码如下:

1 #include <bits/stdc++.h> 2 using namespace std; 3 int main() 4 { 5 double a,ans(0); 6 for(int i = 0; i < 12; ++i) 7 { 8 scanf("%lf",&a); 9 ans += a; 10 } 11 printf("$%.2lf\n",ans/12); 12 return 0; 13 } View Code

 

转载于:https://www.cnblogs.com/Taskr212/p/9603790.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)