题目链接
http://poj.org/problem?id=1004
题解
这么长一串题,结果就求平均数而已。
代码
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
double ans,now;
int main()
{
for (int i=1;i<=12;i++)
cin>>now,ans+=now;
ans=ans/12.0;
cout<<"$"<<ans<<endl;
}
本文提供了一个简单的 POJ 1004 题目的解决方案,该题目要求计算12个月份的平均花费。通过使用 C++ 实现,演示了如何读取输入并计算平均值。
1059

被折叠的 条评论
为什么被折叠?



