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 ...
随机推荐
- 使用AJAX异步提交表单的几种方式
方式一 手工收集所有的用户输入,封装为大的“k1=v1&k2=v2…”键值对形式,使用$.post(url, data,fn)把数据提交给服务器 $.ajax({ type:'post', u ...
- 对数组名取地址 a[ ],&a
C语言规定,数组名代表数组的首地址,也就是第0号元素的地址.所以a==&a[0] 但对数组名取地址时却要注意了,在理解“对数组名取地址”这一表达式的含义时一定要记住:数组名是“数组”这种变量的 ...
- [Python Study Notes]行人检测
# -------------------------------------------------------------- # @文件: 行人识别.py # @工程: blog # @时间: 2 ...
- php学习笔记-while循环
while(condition) { func(); //break the loop } while循环的执行顺序是先判断condition是不是true,如果是true,那么就执行while循环体 ...
- 算法Sedgewick第四版-第1章基础-1.4 Analysis of Algorithms-001分析步骤
For many programs, developing a mathematical model of running timereduces to the following steps:■De ...
- JavaPersistenceWithHibernate第二版笔记-第七章-003Mapping an identifier bag(@OrderColumn、@ElementCollection、@CollectionTable、、)
一.结构 二.代码 1. package org.jpwh.model.collections.listofstrings; import org.jpwh.model.Constants; impo ...
- ARC100C Linear Approximation
传送门 分析 这道题真的好水呀QwQ,想必大家都知道对于式子|x-2|+|x-3|x取什么值可以使式子结果最小,这道题也是这个原理,只需要将要额外减的1.2.3……提前减掉就行了. 代码 #inclu ...
- 505C Mr. Kitayuta, the Treasure Hunter
传送门 题目大意 一共有30000个位置,从第0个位置开始走,第一次走k步,对于每一次走步,可以走上一次的ki+1 ,ki ,ki-1步数(必须大于等于1),每个岛上有value,求最大能得到的val ...
- Python字典内置方法
Python字典包含了以下内置方法: 序号 函数及描述 1 radiansdict.clear()删除字典内所有元素 2 radiansdict.copy()返回一个字典的浅复制 3 radiansd ...
- 修改tomcat默认的编码方式
tomcat8以后默认编码格式是utf-8:7之前的都是iso8859-1 如果默认情况下,tomcat使用的的编码方式:iso8859-1 修改tomcat下的conf/server.xml文件 找 ...