| ||||||||||
| 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 | |||||||||
我写的为什么总是 RE啊啊啊啊啊#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator