菜鸟学习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. SQL中 and or优先级问题(转)

    刚刚在项目中遇到这样一个问题,SQL语句如下: select * from LOAN_BACK_LIBRARY where LIBRARY_ID=1 or LIB_ID=1 and STATUS=3 ...

  2. C++利用指针突破私有成员访问限制

    C++ 面向对象的一大特性就是封装,使用不同的访问控制符来控制外接对其的访问权限.比如: 1 class A 2 { 3 public: 4 A(): i(10){} 5 void print(){ ...

  3. Table XXX is marked as crashed and should be repaired问题

    数据表出错了,查询数据获取不到了. 尝试一 重启mysql service mysqld restart 没用,重启并没有把表修复掉 尝试二 check table vicidial_list;rep ...

  4. Tar打包、压缩与解压缩到指定目录的方法

    tar在linux上是常用的打包.压缩.加压缩工具,他的参数很多,折里仅仅列举常用的压缩与解压缩参数 参数: -c :create 建立压缩档案的参数: -x : 解压缩压缩档案的参数: -z : 是 ...

  5. C读txt到二维数组

    #include<stdio.h> #include<stdlib.h> #define maxn 200 void main() { FILE *fp; int s[maxn ...

  6. mysql基础:mysql与C结合实例

    一个简单的mysql与C的交互,使用了一些mysql的C API! 老鸟掠过,新手能够看看! /****************************************** 本文件学习mysq ...

  7. Prefabs实例化 ResourceMgr

    http://www.xiaobao1993.com/886.html 来源与小宝个人笔记[稍作修改] //使用  Prefabs/Resources/stone1 ResourceMgr.GetIn ...

  8. Sequence one(hdu2610dfs+去重)

    题目:有一个数列N,和一个数字k,输出该数列的前k个子序列,如果k大于N的所有子序列,输出所有符合要求的序列,序列要求不能是递减序列 比如: 3 5 1 3 2 的前五个序列为 1 3 2 1 3 1 ...

  9. Oracle事物基础

    事务 1 事务定义 数据库事务是SQL语句的组合作为一个"工作单元".要么全部完成,要么全部不做. 每个事务都有一个开始和一个结束. 2 事务开始 1. 你连接到数据库并执行DML ...

  10. Ubuntu 13.10 下安装 eclipse

    Ubuntu软件社区用的3.8,个人想用最新版本,所有手动下载安装. 1.下载安装Jdk sudo apt-get install openjdk-7-jdk 2.查看系统JVM sudo updat ...