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

问一下,我这个错到哪里了呢?谢谢了!

Posted by 90401307 at 2004-12-27 16:10:21 on Problem 1011
In Reply To:test Posted by:hawk at 2003-11-26 22:47:13
我的这个用你刚才的数据做是得10的
可是就是不能过啊
不知道为什么???
帮忙看一下吧!
#include<stdio.h>
#include<malloc.h>
void main(){
	int *num,i,sum,n,max,a;
	scanf("%d",&n);
	if(n>64)return;
	while(n!=0){
		sum=0;max=0;
		num=(int*)malloc((n+1)*sizeof(int));
		for(i=1;i<=n;i++){
			scanf("%d",&num[i]);
			if(num[i]>max)
				max=num[i];
			sum=sum+num[i];
		}
		for(a=max;a<=sum;a++){
			if(sum%a==0)
				break;
		}
		printf("%d\n",a);
		free(num);
		scanf("%d",&n);
	}
}
		

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