九度OJ 1148:Financial Management(财务管理) (平均数)
与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
代码:
#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(财务管理) (平均数)的更多相关文章
- 九度oj 题目1087:约数的个数
题目链接:http://ac.jobdu.com/problem.php?pid=1087 题目描述: 输入n个整数,依次输出每个数的约数的个数 输入: 输入的第一行为N,即数组的个数(N<=1 ...
- 九度OJ 1502 最大值最小化(JAVA)
题目1502:最大值最小化(二分答案) 九度OJ Java import java.util.Scanner; public class Main { public static int max(in ...
- 九度OJ,题目1089:数字反转
题目描述: 12翻一下是21,34翻一下是43,12+34是46,46翻一下是64,现在又任意两个正整数,问他们两个数反转的和是否等于两个数的和的反转. 输入: 第一行一个正整数表示测试数据的个数n. ...
- 九度OJ 1500 出操队形 -- 动态规划(最长上升子序列)
题目地址:http://ac.jobdu.com/problem.php?pid=1500 题目描述: 在读高中的时候,每天早上学校都要组织全校的师生进行跑步来锻炼身体,每当出操令吹响时,大家就开始往 ...
- 九度OJ 1531 货币面值(网易游戏2013年校园招聘笔试题) -- 动态规划
题目地址:http://ac.jobdu.com/problem.php?pid=1531 题目描述: 小虎是游戏中的一个国王,在他管理的国家中发行了很多不同面额的纸币,用这些纸币进行任意的组合可以在 ...
- 九度OJ 1024 畅通工程 -- 并查集、贪心算法(最小生成树)
题目地址:http://ac.jobdu.com/problem.php?pid=1024 题目描述: 省政府"畅通工程"的目标是使全省任何两个村庄间都可以实现公路交通(但 ...
- 九度OJ 1371 最小的K个数 -- 堆排序
题目地址:http://ac.jobdu.com/problem.php?pid=1371 题目描述: 输入n个整数,找出其中最小的K个数.例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4 ...
- 九度OJ 题目1384:二维数组中的查找
/********************************* * 日期:2013-10-11 * 作者:SJF0115 * 题号: 九度OJ 题目1384:二维数组中的查找 * 来源:http ...
- hdu 1284 关于钱币兑换的一系列问题 九度oj 题目1408:吃豆机器人
钱币兑换问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Sub ...
随机推荐
- (5)php数组
定义数组 $arr=array('篮球','自行车','海贼王'); 打印指定数组 echo $arr[0]; 打印全部数组 print_r($arr); 改变数组的值 $arr[0]='足球'; 赋 ...
- HDU-ACM“菜鸟先飞”冬训系列赛——第7场 H
Problem H Problem Description 小边为了寻找梦寐以求的骨头误入一个迷宫,它灵敏的嗅觉告诉它,在迷宫中的某一处有一块完美的骨头.由于迷宫会在一段时间后关闭,所以小边必须在一定 ...
- Codeforces 746G New Roads (构造)
G. New Roads ...
- Find Median from Data Stream - LeetCode
Median is the middle value in an ordered integer list. If the size of the list is even, there is no ...
- Longest Increasing Subsequence - LeetCode
Given an unsorted array of integers, find the length of longest increasing subsequence. For example, ...
- dede实战系统:更换成kindEditor编辑器
最近由于项目需要,在搞dedeCMS,发现dede自带的ckEditor在word粘贴这方面做得不是很好,从word上面直接ctrl+V的内容跟wrod上面的表现样式相差很大,客户很不爽(因为是编辑的 ...
- 3747: [POI2015]Kinoman|线段树
枚举左区间线段树维护最大值 #include<algorithm> #include<iostream> #include<cstdlib> #include< ...
- 清空catalina.out报错Permission denied
今天在清空catalina.out的时候报错 [yangkun@sg logs]$ sudo echo '' > catalina.out -bash: catalina.out: Permis ...
- 应用设置Setting的实现
有非常多应用都在iOS设置中有相关的设置.例如以下图: 通过这个设置能够方便的相应用的一些主要的设置进行更改. 要完整的实现这个设置功能,有下面几方面问题须要解决: 1)设置的编写(实现设置的 ...
- show processlist 各个状态说明
执行状态分析 1.Sleep状态 通常代表资源未释放,如果是通过连接池,sleep状态应该恒定在一定数量范围内 实战范例:因前端数据输出时(特别是输出到用户终端)未及时关闭数据库连接,导致因网络连接速 ...