菜鸟学习ACM,纪录自己成长过程中的点滴。

学习的路上,与君共勉。

ACM学习-POJ-1003-Financial Management

Financial Management
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 109412   Accepted: 51958

Description

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.

Input

The input 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.

Output

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.

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

Source

问题要求:
 求12个数的平均数。
问题分析:
.....看到这题目,顿时吓尿了。   我做题目都是看AC率下手的。  从50%开始逐步练习。  不过这道AC率48%的题目,确实水的可以了。  估计大牛们都不屑做这个吧。   好吧,这道也没什么特别需要注意的。 就是类型转换的时候注意下就好了。  直接上代码吧。

#include <stdio.h>

int main()
{
int n = 0;
double sum_ = 0.0;
double each_month; while (~scanf("%lf", &each_month) && n < 12)
{
sum_ += each_month;
n++;
if (n==12)
{
printf("$%.2lf\n", sum_/(double)n);
break;
}
}
return 0;
}

ACM学习-POJ-1004-Financial Management的更多相关文章

  1. poj 1004:Financial Management(水题,求平均数)

    Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 126087   Accepted: ...

  2. [POJ] #1004# Financial Management : 浮点数运算

    一. 题目 Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 173910   Acc ...

  3. OpenJudge/Poj 1004 Financial Management

    1.链接地址: http://poj.org/problem?id=1004 http://bailian.openjudge.cn/practice/1004 2.题目: 总时间限制: 1000ms ...

  4. poj 1004 Financial Management

    求平均数,记得之前在杭电oj上做过一个求平均数的题目,结果因为题目是英文的,我就懵逼了 #include <stdio.h> int main() { ; double num; int ...

  5. [POJ 1004] Financial Management C++解题

    参考:https://www.cnblogs.com/BTMaster/p/3525008.html #include <iostream> #include <cstdio> ...

  6. POJ 3100 Root of the Problem || 1004 Financial Management 洪水!!!

    水两发去建模,晚饭吃跟没吃似的,吃完没感觉啊. ---------------------------分割线"水过....."--------------------------- ...

  7. Financial Management POJ - 1004

    Financial Management POJ - 1004 解题思路:水题. #include <iostream> #include <cstdio> #include ...

  8. POJ 1004:Financial Management

    Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 165062   Accepted: ...

  9. Financial Management 分类: POJ 2015-06-11 10:51 12人阅读 评论(0) 收藏

    Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 164431   Accepted: ...

随机推荐

  1. 使用Hashtable和List结合拼json数据

    在做项目的时候,有时候需要向页面返回一个特定的json类型的数据,一般情况下会有下面的方法进行拼接: public String chongzhiList() throws Exception { L ...

  2. fragment低版本

    http://bbs.csdn.net/topics/390271980 Fragment框架开发东西确实很方便,但是恼人的是从4.0才开始支持.以前的版本必须用兼容模式开发,本人在网上找了大量资料, ...

  3. Cxf -Wsdl2java详细参数附录

    wsdl2java用法: wsdl2java -p com -d src -all  aa.wsdl -p  指定其wsdl的命名空间,也就是要生成代码的包名: -d  指定要产生代码所在目录 -cl ...

  4. codevs1166 矩阵取数游戏

    题目描述 Description [问题描述] 帅帅经常跟同学玩一个矩阵取数游戏:对于一个给定的n*m 的矩阵,矩阵中的每个元素aij均 为非负整数.游戏规则如下: 1. 每次取数时须从每行各取走一个 ...

  5. hdu 1690 The Balance_母函数

    题意:给你n个数,这些数可以互相加或者减,输出在范围[1,sum]里不能通过运算得出的数 思路:套母函数模版 #include <iostream> #include<cstdio& ...

  6. #include <boost/unordered_set.hpp>

    boost.unordered在C++标准容器std::set,std::multiset,std::map和std::multimap的基础上多实现了四个容器:boost::unordered_se ...

  7. 记录一个js切换随机背景颜色的代码

    <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8& ...

  8. 【SDK编程】

    #include <stdio.h> #include <windows.h> int main() { DeleteFile("C:\\test.txt" ...

  9. LeetCode Day1

    Palindrome Linked List /** * LeetCode: Palindrome Linked List * Given a singly linked list, determin ...

  10. Js特效总结

    1.//#hidediv2为一个需要隐藏的div  这个功能实现当点击hidediv2以外的其他任何位置时,隐藏该div $(document).click(function() {          ...