九度OJ 1141:Financial Management (财务管理) (平均数)
时间限制: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
思路:
求平均数。
代码:
#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: 1141
User: liangrx06
Language: C
Result: Accepted
Time:0 ms
Memory:912 kb
****************************************************************/
九度OJ 1141: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 ...
随机推荐
- 【CF721C】Journey(拓扑排序,最短路,DP)
题意:给一个无环的图,问用不超过T的时间从1到n最多可以经过多少个点.要求输出一条路径. 思路:因为无环,可以用DP做.不过因为时间最短的原因要拓扑排序后再DP,目测由底向上的更新也是可以的. ; . ...
- Codeforces878C. Tournament
$n \leq 50000$个人,每个人有$K \leq 10$个属性,现对每一个前缀问:进行比赛,每次任意两人比任意属性,小的淘汰(保证同一属性不会出现两个相同的数),最终有几个人有可能获胜. 明显 ...
- 快充 IC BQ25896 如何判斷 手機插著 adapter 充電器時,adapter Iout 大於限制,adapter Vout 小於 限制,導致 battery 不但沒充電且還需放電。
若電池在 放電時,ICHGR 為0. 若電池在 充電時,ICHGR有變化. 下面有寫到 charge current 所以不是 discharge current 狀況: ...
- [Violet 4] 毕业旅行
2718: [Violet 4]毕业旅行 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 672 Solved: 389[Submit][Status ...
- Usaco_Contest_2013_Open_Bovine Problem 1. Bovine Ballet
Problem 1: Bovine Ballet [Brian Dean, 2013] In an attempt to challenge the stereotypical perception ...
- Office 各版本下载链接
Office 2007 链接: https://pan.baidu.com/s/1pNJDlafw6KQSlljRUAQtWw 提取码: xoml 密钥:DBXYD-TF477-46YM4-W74MH ...
- DBUtils工具类学习一
Commons DbUtils是Apache组织提供的一个对JDBC进行简单封装的开源工具类库,使用它能够简化JDBC应用程序的开发,同时也不会影响程序的性能 1.特征 DBUtils是java编程中 ...
- Maven 项目打包发布
在Eclipse左侧右击项目,Debug As -> Debug Configurations -> 双击Maven Build 然后看弹出框的右侧右侧的Name随便填写一个名字,Base ...
- Redis 数据结构解析和命令指南
命令參考文档:redis commands - 你或许已经知道Redis并非简单的key-value存储.实际上他是一个数据结构server.支持不同类型的值. 也就是说.你不必只把字符串当作键所指向 ...
- app后端开发系列文章文件夹
一点废话 每个程序猿心中,都有一个大牛梦.我们在晨曦之光中敲击着代码,在寒冬覆雪中思考着0与1. 夏练三伏 冬练三九这说的就是我们这群[江湖]中人.在这里我们门派林立,C语言派历史悠久,在程序界就是嵩 ...