一. 题目
Financial Management
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 173910   Accepted: 65186

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

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

Source

 
二. 题意
  • 给出最近十二个月,银行账户的每期余额
  • 算出每个月的平均余额

三. 分析

  • 算法核心: 题目较为简单,无需考虑任何算法
  • 实现细节:
    • 浮点数运算
    • 浮点数输出格式

四. 题解

 #include <stdio.h>

 int main()
{
int i;
float balance, sum = ; for (i = ; i < ; i++) {
scanf("%f\n", &balance);
sum += balance;
} printf("$%.2f\n", (sum / )); return ;
}

[POJ] #1004# Financial Management : 浮点数运算的更多相关文章

  1. poj 1004:Financial Management(水题,求平均数)

    Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 126087   Accepted: ...

  2. OpenJudge/Poj 1004 Financial Management

    1.链接地址: http://poj.org/problem?id=1004 http://bailian.openjudge.cn/practice/1004 2.题目: 总时间限制: 1000ms ...

  3. poj 1004 Financial Management

    求平均数,记得之前在杭电oj上做过一个求平均数的题目,结果因为题目是英文的,我就懵逼了 #include <stdio.h> int main() { ; double num; int ...

  4. [POJ 1004] Financial Management C++解题

    参考:https://www.cnblogs.com/BTMaster/p/3525008.html #include <iostream> #include <cstdio> ...

  5. POJ 3100 Root of the Problem || 1004 Financial Management 洪水!!!

    水两发去建模,晚饭吃跟没吃似的,吃完没感觉啊. ---------------------------分割线"水过....."--------------------------- ...

  6. Financial Management POJ - 1004

    Financial Management POJ - 1004 解题思路:水题. #include <iostream> #include <cstdio> #include ...

  7. POJ 1004:Financial Management

    Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 165062   Accepted: ...

  8. Financial Management 分类: POJ 2015-06-11 10:51 12人阅读 评论(0) 收藏

    Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 164431   Accepted: ...

  9. [POJ] Financial Management

    Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 182193   Accepted: ...

随机推荐

  1. Types of Entity in Entity Framework:

    http://www.entityframeworktutorial.net/Types-of-Entities.aspx We created EDM for existing database i ...

  2. plsql programming 18 包

    所谓包, 就是把一组PL/SQL 的代码元素组织在一个命名空间下. 另外, 包的用法就类似java中的类.( 有封装, 有重载, 没有继承和多肽) create or replace procedur ...

  3. 修改tomcat小猫图标

    网站放到网上去了,不喜欢大家访问的时候可以看到tomcat的小猫图标.今天在网上搜了搜,总结一下收藏了. 1.直接找个16*16的ico图片.放到tomcat/root下,取个名叫favicon.ic ...

  4. PHP的模板引擎这点事儿

    什么是模板引擎? 为什么要使用它? 为什么要assign一个变量给模板? https://dbforch.wordpress.com/2010/06/26/the-logic-behind-templ ...

  5. UVa 714 (二分) Copying Books

    首先通过二分来确定这种最大值最小的问题. 假设每个区间的和的最大值为x,那么只要判断的时候只要贪心即可. 也就是如果和不超过x就一直往区间里放数,否则就开辟一个新的区间,这样来判断是否k个区间容得下这 ...

  6. linux修改文件夹及其子文件夹的权限

    加入-R 参数,就可以将读写权限传递给子文件夹例如chmod -R 777 /home/mypackage那么mypackage 文件夹和它下面的所有子文件夹的属性都变成了777.777是读.写.执行 ...

  7. JS改变input的value值不触发onchange事件解决方案 (转)

    方法(一)(转载的网络资料) 需要了解的知识     首先,我们需要了解onchange和onpropertychange的不同: IE下,当一个HTML元素的属性改变的时候,都能通过 onprope ...

  8. Qt 获取usb设备信息 hacking

    /************************************************************************** * Qt 获取usb设备信息 hacking * ...

  9. 使用dev http client调试restful API开发

    安装chrome 插件:dev http client, 使用VPN打开 google网站,

  10. 【英语】Bingo口语笔记(38) - See系列

    see somebody off 送别 see somebody out 看到谁从哪里出来