ZOJ1048 Financial Management
来源:互联网 发布:pojdijkstra算法 编辑:程序博客网 时间:2024/04/30 04:08
Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what's been going on with his money. Larry has his bank account statements and wants to see how much money he has. Help Larry by writing a program to take his closing balance from each of the past twelve months and calculate his average account balance.
Input Format:
The input will be twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included.
Output Format:
The output will be a single number, the average (mean) of the closing balances for the twelve months. It will be rounded to the nearest penny, preceded immediately by a dollar sign, and followed by the end-of-line. There will be no other spaces or characters in the output.
Sample Input:
100.00
489.12
12454.12
1234.10
823.05
109.20
5.27
1542.25
839.18
83.99
1295.01
1.75
Sample Output:
$1581.42
这题大意也就是求平均数,保留两位有效数字。
#include <iostream>#include <cstdio>using namespace std;int main() {double sum = 0;double p;int t = 0;while (cin >> p) {sum += p;t++;}if (t)printf("$%.2lf\n",sum/t);return 0;}
- zoj1048-Financial Management
- ZOJ1048 Financial Management
- zoj1048 Financial Management
- Financial Management ZOJ1048(简单计算)
- UVALive2362 POJ1004 HDU1064 ZOJ1048 Financial Management
- Financial Management
- Financial Management
- Financial Management
- Financial Management
- Financial Management
- financial management
- Financial Management
- Financial Management
- Financial Management
- Financial Management
- Financial Management
- Financial Management
- Financial Management
- JVM调优总结(十) -调优方法
- windows编程调试错误信息
- Android界面适配机制
- 重点:数组
- 一致性哈希及其在分布式系统中的应用
- ZOJ1048 Financial Management
- 改进的newlisp编译脚本,只需要配置
- hdu4588前缀 分区间计算
- 高德地图api之basic map
- JVM调优总结(十一) - JVM参数大全
- 全面介绍Windows内存管理机制及C++内存分配实例
- ZOJ1295 Reverse Text
- 面向对象,静态变量、类与对象、成员变量
- Ajax学习系列4— 通过DWR简化AJAX开发