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

我写的为什么总是 RE啊啊啊啊啊

Posted by 20113113 at 2011-11-28 14:52:55 on Problem 1011
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
 int m=0,b; 
 int k; 
 int a[64]={0};
 int n;
 int i,j=0;
 while(scanf("%d",&n)!=EOF)
 {
	 if(n==0)
		 break;
	 else
	 {
	 m=0;
	 for(i=0;i<n;i++)
	 {
	     scanf("%d",&a[i]);		
	 }
	 for(i=0;i<n;i++)
		 for(j=0;j<n-1;j++)
			 if(a[j]>a[j+1])
			 {
				 k=a[j];
				 a[j]=a[j+1];
				 a[j+1]=k;
			 }

	 	 for(i=0;i<n;i++)
	 {
		 m=m+a[i];
		
	 }
	i=0;
	 for((k=a[n-1]+a[0]);;)
	 {   
		 if(m%k==0)
		 {
			 printf("%d\n",k);
			 break;                  
		 }
		 i++;
	     k=a[n-1]+a[i];
		 
	 }
	 }
 }     
 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