| ||||||||||
| 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 | |||||||||
求救:为什么错了#include<iostream.h>
void main(){
int len[100];
int choice;
while(1){
cin>>choice;
if(choice==0)
break;
for(int i=0;i<choice;i++)
cin>>len[i];
int sum=0;
int max=len[0];
for(i=0;i<choice;i++){
sum+=len[i];
if(max<len[i])
max=len[i];
}
int *a;
a=new int[choice];
for(i=0;i<choice;i++)
a[i]=0;
int temp=sum;
for(i=1;i<choice;i++){
sum=temp;
if(sum%i==0){
sum/=i;
if(sum<=max)
break;
a[i]=sum;
}
}
int min=a[1];
for(int j=1;j<i;j++){
if(a[j]!=0 && a[j]<min)
min=a[j];
}
cout<<min<<endl;
delete []a;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator