Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求教高手,急救啊,为什么wrong answer

Posted by haaoly at 2009-05-19 22:20:07 on Problem 1011 and last updated at 2009-05-19 22:27:05
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator