POJ1004 Financial Management
题目来源:http://poj.org/problem?id=1004
题目大意:
Larry今年毕业并找到了工作。他开始赚很多的钱,然而他似乎总觉得不够。Larry决定好好掌控他的资产,解决他的财务问题。第一步就是找出他的钱到底发生了什么。Larry有一个银行账户,他希望知道他有多少钱。帮助Larry写一个程序,读入他过去12个月里每个月结束时的账户余额,计算出他每月平均账户余额。(实质就是求12个数的平均数。)
输入:由12行组成,每行一个正的浮点数,计到小数点后两位。表示每月结束时的账户余额,不含dollar符号。
输出:输出为1个浮点数,即每月平均账户余额,采用四舍五入,保留2为小数。以dollar符号开头,以end-of-line结束,输出中不含其它空白或符号。
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
实质就是求12个浮点数的平均数,稍注意格式之类的要求即可。
//////////////////////////////////////////////////////////////////////////
// POJ1004 #include <iostream>
// Memory: 276K Time: 16MS
// Language: C++ Result: Accepted
////////////////////////////////////////////////////////////////////////// using namespace std; int main(void) {
double closingBalance[];
for(int i = ; i < ; i++) {
cin >> closingBalance[i];
}
double average = ;
for(int i = ; i < ; i++) {
average += closingBalance[i];
}
average /= ;
cout << "$";
printf("%.2f", average);
cout << endl;
system("pause");
return ;
}
POJ1004 Financial Management的更多相关文章
- 练习英语ing——[POJ1004]Financial Management
[POJ1004]Financial Management 试题描述 Larry graduated this year and finally has a job. He's making a lo ...
- Financial Management[POJ1004]
Financial Management Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 179458 Accepted: ...
- poj 1004:Financial Management(水题,求平均数)
Financial Management Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 126087 Accepted: ...
- Financial Management 分类: POJ 2015-06-11 10:51 12人阅读 评论(0) 收藏
Financial Management Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 164431 Accepted: ...
- Introduction to Financial Management
Recently,i am learning some useful things about financial management by reading <Essentials of Co ...
- [POJ] #1004# Financial Management : 浮点数运算
一. 题目 Financial Management Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 173910 Acc ...
- Financial Management
Financial Management 时间限制:3000 ms | 内存限制:65535 KB 难度:1 描述 Larry graduated this year and finally ...
- Financial Management POJ - 1004
Financial Management POJ - 1004 解题思路:水题. #include <iostream> #include <cstdio> #include ...
- UVA 11945 Financial Management 水题
Financial Management Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 acm.hust.edu.cn/vjudge/problem/vis ...
随机推荐
- spring @Resource与@Autowired注解详解
具有依赖关系的Bean对象,利用下面任意一种注解都可以实现关系注入: 1)@Resource (默认首先按名称匹配注入,然后类型匹配注入) 2)@Autowired/@Qualifier (默认按类型 ...
- mybatis(非常详细的哦~~~~)
备注:ibatis 迁入google code 更名为Mybatis 官方文档:http://mybatis.org/mybatis-3/ 比较好的教程推荐:http://www.blogjava.n ...
- hive like 模糊匹配
类似: 在MYSQL里面我们可以这样的执行SQL select a.Community,a.PID,b.spidertime,b.comm,b.showings,b.room from lianjia ...
- Composite模式 组合模式
Android的ViewGroup 和 View 的关系,即是采用组合模式 1. 概述 在数据结构里面,树结构是很重要,我们可以把树的结构应用到设计模式里面. 例子1:就是多级树形菜单. 例子2:文件 ...
- 1-1+zookeeper简介
zookeeper是中间件,可以为分布式系统提供协调服务.如果没有分布式系统,zookeeper也发挥不了它的优势.
- 九款常用的JS代码高亮工具
代码高亮很重要,特别是当我们想要在网站或博客中展示我们的代码的时候.通过在网站或博客中启用代码高亮,读者更方便的读取代码块. 有很多免费而且有用的代码高亮脚本.这些脚本大部分由Javascripts编 ...
- Switch/Case 的穿透性
/*键盘录入1到12 ,对应输出该月份对应的季节 .如果输入的不是1到12,输出提示信息:您输入的数据有误. PS: 春季:3,4,5月份 夏季: 6,7,8月份 秋季: 9,10,11月份 冬季:1 ...
- mac上virtualBox的安装和使用
一.下载和安装 去oracle官网下载mac版的virtualBox. 官网下载地址:https://www.virtualbox.org/. 下载好后按照向导进行安装即可. 二.使用方法 1.新建虚 ...
- LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
reinterpret_cast代表强制转化,即把pNMHDR强制转化成LPNMITEMACTIVATE类型的. reinterpret_cast<type-id> (expression ...
- 283E&EZOJ #89 Cow Tennis Tournament
传送门 分析 我们考虑用所有的情况减去不合法的情况 不难想出所有情况为$C_n^3$ 于是我们考虑不合法的情况 我们知道对于一个不合法的三元组$(a,b,c)$一定是修改后$a<b,b>c ...