5
POJ 1004 - Financial Management
source link: https://exp-blog.com/algorithm/poj/poj1004-financial-management/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Financial Management
- POJ 1004 - Financial Management
- Time: 1000MS
- Memory: 10000K
- 难度: 水题
2011年5月ACM珠海赛的试机题
水题,直接求解即可。
/*
Author: Exp
Date: 2017-11-29
Code: POJ 1004
Problem: Financial Management
URL: http://poj.org/problem?id=1004
*/
/*
题意分析:
每次输入12个浮点数,求其平均数(注意输出精度为2位小数)
*/
#include <iomanip>
#include <iostream>
using namespace std;
int main(void) {
const int N = 12;
double sum = 0.0;
for(int i = 0; i < N; i++) {
double num = 0.0;
cin >> num;
sum += num;
}
double avg = sum / N;
cout << fixed << setprecision(2) << '$' << avg << endl;
//system("pause");
return 0;
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK