Pku oj 1004 Financial Management(水题)
2016-08-13 11:23
211 查看
Financial Management
Description
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
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
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
Sample Output
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 176043 | Accepted: 66198 |
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
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
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
这种题怎么会出现在poj上。。。。求平均数= =
#include<iostream> #include<algorithm> #include<cstring> #include<cmath> using namespace std; int main() { float x; float sum=0; int cnt=0; while(~scanf("%f",&x)) { cnt++; sum=sum+x; if(cnt==12) { printf("$%.2f\n",sum/12); cnt=0; sum=0; } } return 0; }
相关文章推荐
- 福州大学 OJ FZU 1683 矩阵水题
- pku 2159 水题,题意有些难懂,特意贴出来,以候来者
- 素数三元组(南阳oj1156)(素数水题)
- 杭电OJ(HDOJ)1032题:The 3n + 1 problem(穷举,水题)
- 九度OJ 1004
- PKUOJ1593 World Cup Noise
- PKUOJ1042 Gone Fishing
- 九度oj 题目1004:Median 【ZJU2011考研机试题3】
- 哈理工OJ 1425 阶乘问题(水题)
- 老oj2146 && Pku2135 Farm Tour
- HDU 1004 数论水题
- 杭电OJ——1196 Lowest Bit(水题)
- pku 1083 水题
- UVA oj 练习水题 算法入门经典(大数系列)
- UVA oj 10300 Ecological Premium(水题)
- PKUOJ1458 Common Subsequence
- 九度 OJ 1004 median
- 哈理工OJ 1431 摞盘子【水题】
- 北大OJ_1004题:Financial Management
- 杭电OJ——1173 采矿(水题)