Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:求教高手,急救啊,为什么wrong answerIn Reply To:求教高手,急救啊,为什么wrong answer Posted by:haaoly at 2009-05-19 22:20:07 > #include<iostream> > #include<cmath> > using namespace std; > int max(int a,int p) > {int b; > b=(a>p?a:p); > return b; > } > > int main() > { int a,b,c,m;float d,s; > while(cin>>a&&a<=64&&a) > {m=0,s=0; > for(0,b=1;b<=a;b++) > { > cin>>c; > m=max(m,c); > s+=c; > } > for(b=64;b>=1;b--) > { d=s/(b*1.0); > if(d>float(m)) > { > int e=d; > int f=d+1; > if(d-e<=1e-12||f-d<=1e-12) > {cout<<d<<endl; > break; > } > } > } > } > return 0; > } > Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator