您的位置:首页 > 其它

poj 1004 Financial Management

2013-07-29 11:53 253 查看
Financial Management

Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 97874
Accepted: 47335
Description
Larrygraduated this year and finally has a job. He's making a lot of money, butsomehow never seems to have enough. Larry has decided that he needs to grabhold of his financial portfolio and solve his financing problems. The firststep is to figure
out what's been going on with his money. Larry has his bankaccount statements and wants to see how much money he has. Help Larry bywriting a program to take his closing balance from each of the past twelvemonths and calculate his average account balance.
Input
The inputwill be twelve lines. Each line will contain the closing balance of his bankaccount for a particular month. Each number will be positive and displayed tothe penny. No dollar sign will be included.
Output
The outputwill be a single number, the average (mean) of the closing balances for thetwelve months. It will be rounded to the nearest penny, preceded immediately bya dollar sign, and followed by the end-of-line. There will be no other spacesor
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
Financial Management

Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 97874
Accepted: 47335
Description
今年毕业并找到了一个工作。他已经能够挣很多钱,但是总感觉不够用。Larry已经决定抓住他的金融市场的投资来解决经济危机。第一步是计算出他的钱哪里去了。Larry有一个他的银行账目表可以查看他有多少钱。写一个程序帮助Larry计算过去12年里的平均账目。
Input
输入包括12行。每一行包括一个月的银行账单月终余额。每一个数字都是正的以便士为单位。没有美元的符号。
Output
输出一个数字,12月的平均值。四舍五入后并加上一个美元的符号,最后一行没有多余的空格和字符。
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
//很水的题哟,不过很神奇的是= w=,如果用double就会w。。。。。。ono

#include<stdio.h>
#include<string.h>
#include<math.h>

void input(void);

int main(void){
freopen("in.txt","r", stdin);
input();
return 0;
}

void input(void){
float f, s=0;
int i;
for (i = 0;i < 12;i ++){
scanf("%f", &f);
s+=f;
}
printf("$%.2f", s/12);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: