时间限制:1 秒

内存限制:32 兆

特殊判题:否

提交:939

解决:489

题目描述:

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.

输入:

Each case 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.

输出:

For each case, 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.

样例输入:

100.00

489.12

12454.12

1234.10

823.05

109.20

5.27

1542.25

839.18

83.99

1295.01

1.75

样例输出:

$1581.42

来源:

2009年北京大学计算机研究生机试真题

思路:

求平均数。

代码:

#include

int main(void)

{

int n, i;

double cost;

double sum;

while (scanf("%lf", &cost) != EOF)

{

sum = cost;

for(i=1; i<12; i++)

{

scanf("%lf", &cost);

sum += cost;

}

printf("$%.2lf\n", sum/12);

}

return 0;

}

/**************************************************************

Problem: 1141

User: liangrx06

Language: C

Result: Accepted

Time:0 ms

Memory:912 kb

****************************************************************/

财务管理c语言oj,九度OJ 1141:Financial Management (财务管理) (平均数)相关推荐

  1. 打不开磁盘配额linux,九度OJ 1455 珍惜现在,感恩生活 -- 动态规划(背包问题)...

    题目描述: 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买.请问:你用有限的资金最 ...

  2. Freckles - 九度 OJ 1144

    Freckles - 九度 OJ 1144 题目 时间限制:1 秒 内存限制:128 兆 特殊判题:否 题目描述: In an episode of the Dick Van Dyke show, l ...

  3. 非常可乐(九度 OJ 1457)

    非常可乐(九度 OJ 1457) 时间限制:1 秒 内存限制:32 兆 特殊判题:否 1.题目描述: 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是 seeyou 却不这么认为.因为每次当 see ...

  4. 九度OJ 题目1179:阶乘

    /********************************* * 日期:2013-2-8 * 作者:SJF0115 * 题号: 九度OJ 题目1179:阶乘 * 来源:http://ac.jo ...

  5. 九度OJ——1028继续畅通工程

    题目描述: 省政府"畅通工程"的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可).现得到城镇道路统计表,表中列出了任意两城镇间修 ...

  6. Leagal or Not - 九度 OJ 1448

    Leagal or Not - 九度 OJ 1448 题目 时间限制:1 秒 内存限制:128 兆 特殊判题:否 题目描述: ACM-DIY is a large QQ group where man ...

  7. 九度OJ 题目1069:查找学生信息 随笔

    ** 九度OJ 题目1069:查找学生信息 ** 题目描述如下: 输入N个学生的信息,然后进行查询. 输入 输入的第一行为N,即学生的个数(N<=1000) 接下来的N行包括N个学生的信息,信息 ...

  8. 九度OJ 题目1203:IP地址

    /********************************* * 日期:2013-2-8 * 作者:SJF0115 * 题号: 九度OJ 题目1203:IP地址 * 来源:http://ac. ...

  9. 九度OJ 1024 畅通工程 -- 并查集、贪心算法(最小生成树)

    题目地址:http://ac.jobdu.com/problem.php?pid=1024 题目描述: 省政府"畅通工程"的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有 ...

最新文章

  1. 2015年12月流量入口占比动态:仅直接访问实现上涨
  2. signature=eddfa127dafaf9a7c1ea87598961fbc9,Slingerende vrachtwagens verleden tijd?
  3. NYOJ 598 旋转圆柱矩阵
  4. OpenGL Blinn-Phong Shader实例
  5. live555 源码分析:基础设施
  6. 有效的数独Python解法
  7. 微软TypeScript 3.0重磅发布!扶我起来,我还学得动
  8. leetcode - 764. 最大加号标志
  9. pyqt——布局管理
  10. 学习笔记-模块之xml文件处理
  11. 一个正经的前端学习 开源 仓库(阶段二十六)
  12. Python修改图片大小
  13. 大数据中心建设一哄而上 人才技术制约产业发展
  14. java什么是继承_JAVA中什么是继承?
  15. struct tm 中的 tm_isdst 以及 mktime
  16. 机器人开发--Odoo(OpenERP)
  17. 微信小程序如何保存图片到相册
  18. echarts 环状图中添加图片
  19. Hive错误之 Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask错误分析
  20. gpio操作实现人体感应灯(一)

热门文章

  1. Web中常用字体介绍(转)
  2. Memcached服务端自动启动(转载)
  3. [转]这才是真正的3D显示!Leap Motion推出次毫米级3D手动控制技术,让人手和影像融为一体...
  4. android Listview2 笔记
  5. varchar和Nvarchar区别
  6. 分析了2.2W条抖音数据,发现“95后”其实很养生……
  7. 数据科学、人工智能TED演讲TOP 10
  8. 阿里云96页报告详解《云上转型》(10个案例、10大趋势/完整版PPT)
  9. STM32之内部FLASH原理
  10. 微软再出手!这次要干翻 IDEA 了。。