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 ...
随机推荐
- 使用Ping命令解析主机名解析出来的是IPv6
如果你经常使用ping命令,并身处局域网,那么你肯定会有这样一个疑问:Ping计算机名为何是IPv6地址? 问这个问题的人很少见,大多都是对网络知识稍有了解的人,所以才会闻到关于ping的问题,而且在 ...
- 嵌入式Linux启动优化手记2 U…
参考一下 原文地址:U-boot优化">嵌入式Linux启动优化手记2 U-boot优化作者:ZhaoJunling 既然不能使用新的U-boot,那就优化一点是一点,慢慢干吧. 1. ...
- Codeforces 1142D(dp)
题目传送 先给出设计dp的结论: dp[i][j]:以第i个位置.以rankj的数拓展出去的方案数.意会一下,我实在想不好语言-- 其中所谓rankj=真·rank%11 找到拓展的规律,转移也就顺理 ...
- 关于A类,B类,C类IP地址的网段和主机数的计算方法
关于A类,B类,C类IP地址的网段和主机数的计算方法 IP地址是一个32位的二进制数,由四个八位字段组成.每个IP地址包括两部分:一部分为网络标识(网络号),一部分为主机标识(主机号). A类地址前8 ...
- SpringBoot04 日志框架之Logback
1 日志框架选择 日志门面:SLF4J 日志实现:Logback 2 实现控制台的日志打印输出01 2.1 在需要实现日志信息打印的类中实例化Logger对象 坑01:springBoot项目默认使用 ...
- php学习笔记-if else
生活不会总是波澜不惊的,要是那样也没有什么意思.代码也一样,if else的出现为平静的生活带来一点变化. <?php $money = 1000; if($money>0) { //sl ...
- Python字典内置方法
Python字典包含了以下内置方法: 序号 函数及描述 1 radiansdict.clear()删除字典内所有元素 2 radiansdict.copy()返回一个字典的浅复制 3 radiansd ...
- C# 使用SendMessage 函数
在C#中,程序采用了的驱动采用了事件驱动而不是原来的消息驱动,虽然.net框架提供的事件已经十分丰富,但是在以前的系统中定义了丰富的消息对系统的编程提供了方便的实现方法,因此在C#中使用消息有时候还是 ...
- html5 canvas绘制矩形和圆形
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 使用metasploit进行栈溢出攻击-2
基本的栈溢出搞明白了,真实攻击中一个很重要的问题是shellcode生成. 利用Metasploit提供的工具,可以方便的生成shellcode,然后可以使用第一篇中的代码进行验证. 先说一下如何生成 ...