与1141题相同。

时间限制:1 秒

内存限制:32 兆

特殊判题:否

提交:843

解决:502

题目描述:

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
来源:
2010年北京大学计算机研究生机试真题

代码:

#include <stdio.h>

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: 1148
User: liangrx06
Language: C
Result: Accepted
Time:0 ms
Memory:912 kb
****************************************************************/

九度OJ 1148:Financial Management(财务管理) (平均数)的更多相关文章

  1. 九度oj 题目1087:约数的个数

    题目链接:http://ac.jobdu.com/problem.php?pid=1087 题目描述: 输入n个整数,依次输出每个数的约数的个数 输入: 输入的第一行为N,即数组的个数(N<=1 ...

  2. 九度OJ 1502 最大值最小化(JAVA)

    题目1502:最大值最小化(二分答案) 九度OJ Java import java.util.Scanner; public class Main { public static int max(in ...

  3. 九度OJ,题目1089:数字反转

    题目描述: 12翻一下是21,34翻一下是43,12+34是46,46翻一下是64,现在又任意两个正整数,问他们两个数反转的和是否等于两个数的和的反转. 输入: 第一行一个正整数表示测试数据的个数n. ...

  4. 九度OJ 1500 出操队形 -- 动态规划(最长上升子序列)

    题目地址:http://ac.jobdu.com/problem.php?pid=1500 题目描述: 在读高中的时候,每天早上学校都要组织全校的师生进行跑步来锻炼身体,每当出操令吹响时,大家就开始往 ...

  5. 九度OJ 1531 货币面值(网易游戏2013年校园招聘笔试题) -- 动态规划

    题目地址:http://ac.jobdu.com/problem.php?pid=1531 题目描述: 小虎是游戏中的一个国王,在他管理的国家中发行了很多不同面额的纸币,用这些纸币进行任意的组合可以在 ...

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

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

  7. 九度OJ 1371 最小的K个数 -- 堆排序

    题目地址:http://ac.jobdu.com/problem.php?pid=1371 题目描述: 输入n个整数,找出其中最小的K个数.例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4 ...

  8. 九度OJ 题目1384:二维数组中的查找

    /********************************* * 日期:2013-10-11 * 作者:SJF0115 * 题号: 九度OJ 题目1384:二维数组中的查找 * 来源:http ...

  9. hdu 1284 关于钱币兑换的一系列问题 九度oj 题目1408:吃豆机器人

    钱币兑换问题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

随机推荐

  1. Hrbust 2319 Number Game(贪心)

    题目链接  Hrbust 2319 首先把二元组排序,$ai$大的排前面,$ai$相同的$bi$大的排前面. 这样的话就满足了Kim的取数顺序,即选每次$ai$最大的. 考虑得坏一些,在$ai$相同的 ...

  2. Topcoder SRM 664 DIV 1

    BearPlays 快速幂 题意: 给你两个数A,B,有种操作是将大的数减去小的数,并将小的数乘以2.反复k次,问你最后的小的数回是多少. 题解: 由于整个过程$A+B$的值是不会改变的.现在令$S= ...

  3. js判断是否是PC,IOS,Android客户端

    写在前面 在项目中使用html5,需要针对不同的客户端浏览器有不一样的处理方式,这就需要对请求中的useragent进行分析,并进行处理. 一个例子 <%@ Page Language=&quo ...

  4. 避免在block中循环引用(Retain Cycle in Block)

    让我们长话短说.请参阅如下代码: - (IBAction)didTapUploadButton:(id)sender { NSString *clientID = @"YOUR_CLIENT ...

  5. VS2010 MFC中 给菜单项添加消息响应函数

    久了没用,居然忘记了该怎样给菜单项添加响应函数了~~~~~~~~T_T 特记于此: 1. 在资源视图的Menu里找到自己要添加的菜单,然后输入菜单项. 2. 右击菜单项选属性,设置Popup为Fals ...

  6. 最小二乘法及C语言实现

    我们以最简单的一元线性模型来解释最小二乘法.什么是一元线性模型呢? 监督学习中,如果预测的变量是离散的,我们称其为分类(如决策树,支持向量机等),如果预测的变量是连续的,我们称其为回归.回归分析中,如 ...

  7. Hadoop一些问题总结

    1.运行mr程序出错 connecting to resoucemanager retrying .... retrying ..... 原因是没有启动yarn或者启动失败 2.初始化工作目录结构 h ...

  8. 可软件定义的存储逻辑——Efficient and agile storage management in software defined environments

            note:写这个或许算是翻译,又或算是对这个论文[1]的理解,又或者仅仅是我的看法.         这篇论文和IOFlow相比較,更加注重软件定义存储的框架(利用已有的框架来创建新的 ...

  9. Mjpg_Streamer 的移植

    1. 移植mjpg-streamer a.1 移植libjpeg tar zxf libjpeg-turbo-1.2.1.tar.gz cd libjpeg-turbo-1.2.1 ./configu ...

  10. Linux下Nginx安全证书ssl配置方法

    分享下我是如何一步步在Nginx上配置SSL的.首先,确保安装了OpenSSL库,并且安装Nginx时使用了–with-http_ssl_module参数. 初学者或者菜鸟建议使用LNMP进行一键安装 ...