Home | Problems | Discuss | Login

  

why don't output,where is wrong?help me!!

1045: Sticks

dahema | 2007-10-29 22:43:33 | delete | edit
ʲôеݹ
 
zhanglindong | 2006-07-19 21:29:56 | delete | edit
Ҫĵݹ   
windy7926778 | 2006-07-19 19:23:45 | delete | edit
 
chengning | 2006-07-18 21:42:50 | delete | edit
#include<iostream.h>
int main()
{
	int k,m,sum=0,i,j,N,M[100];
	cin>>k;
    while(k!=0)
	{
	for(i=0;i<k;i++)
	{
		cin>>M[i];
	}
	for(i=0;i<k;i++)
	{
		for(j=0;j<k;j++)
           if(M[i]>=M[j])
		   {
	     	  N=M[i];
			  continue;
		   }
		   else break;
	}
	for(i=0;i<k;i++)
		sum+=M[i];
    for(j=N;j>0;j--)
		{
           m=sum/j;
           if(m>=N) 
		   {
			   cout<<m<<endl;
			   continue;}
           else
		        break;

		}
	cin>>k;
	}
    return 0;
}
 

Please login to reply.