POJ 1004 Financial Management
2012-04-23 12:47
381 查看
FinancialManagement
Description
Larrygraduatedthisyearandfinallyhasajob.He'smakingalotofmoney,butsomehowneverseemstohaveenough.Larryhasdecidedthatheneedstograbholdofhisfinancialportfolioandsolvehisfinancingproblems.The
firststepistofigureoutwhat'sbeengoingonwithhismoney.Larryhashisbankaccountstatementsandwantstoseehowmuchmoneyhehas.HelpLarrybywritingaprogramtotakehisclosingbalancefromeachofthepasttwelvemonthsandcalculatehis
averageaccountbalance.
Input
Theinputwillbetwelvelines.Eachlinewillcontaintheclosingbalanceofhisbankaccountforaparticularmonth.Eachnumberwillbepositiveanddisplayedtothepenny.Nodollarsignwillbeincluded.
Output
Theoutputwillbeasinglenumber,theaverage(mean)oftheclosingbalancesforthetwelvemonths.Itwillberoundedtothenearestpenny,precededimmediatelybyadollarsign,andfollowedbytheend-of-line.Therewillbe
nootherspacesorcharactersintheoutput.
SampleInput
SampleOutput
TimeLimit:1000MS | MemoryLimit:10000K | |
TotalSubmissions:87085 | Accepted:42411 |
Larrygraduatedthisyearandfinallyhasajob.He'smakingalotofmoney,butsomehowneverseemstohaveenough.Larryhasdecidedthatheneedstograbholdofhisfinancialportfolioandsolvehisfinancingproblems.The
firststepistofigureoutwhat'sbeengoingonwithhismoney.Larryhashisbankaccountstatementsandwantstoseehowmuchmoneyhehas.HelpLarrybywritingaprogramtotakehisclosingbalancefromeachofthepasttwelvemonthsandcalculatehis
averageaccountbalance.
Input
Theinputwillbetwelvelines.Eachlinewillcontaintheclosingbalanceofhisbankaccountforaparticularmonth.Eachnumberwillbepositiveanddisplayedtothepenny.Nodollarsignwillbeincluded.
Output
Theoutputwillbeasinglenumber,theaverage(mean)oftheclosingbalancesforthetwelvemonths.Itwillberoundedtothenearestpenny,precededimmediatelybyadollarsign,andfollowedbytheend-of-line.Therewillbe
nootherspacesorcharactersintheoutput.
SampleInput
100.00 489.12 12454.12 1234.10 823.05 109.20 5.27 1542.25 839.18 83.99 1295.01 1.75
SampleOutput
$1581.42
java代码如下:
importjava.util.Scanner;
publicclassMain{
publicstaticvoidmain(String[]args){
Scannerin=newScanner(System.in);
doublea[]=newdouble[12];
doublesum=0.0;
for(inti=0;i<12;i++){
a[i]=in.nextDouble();
sum+=a[i];
}
sum/=12;
System.out.printf("$%.2f\n",sum);
}
}
相关文章推荐
- poj 1004
- POJ 1004
- poj 1004 Financial Management
- POJ 1004 Financial Management
- POJ_1004_Financial Management
- poj1004 Financial Management
- POJ-1004 Financial Management
- POJ 1004 Financial Management
- POJ 1004
- POJ 1004
- POJ 1004 Financial Management
- POJ 1004 Financial Management 解题报告
- 北大POJ解题报告-1004 Financial Management
- POJ - 1004
- poj 1004
- POJ 1004 - Financial Management
- POJ 1004 与 iomanip
- poj 1004
- POJ 1004 Financial Management
- poj 1004 I Think I Need a Houseboat