sai901013 2008-05-24 23:15:00
点我顶贴
收藏
删除
#include <stdio.h>
#include <conio.h>
int main()
{
int a[101]={\0}
int one=0
int two=0
int n=0
int i,j,swap,temp
scanf("%d",&n)
for ( i=0 i<n i++ )
scanf("%d",&a[i])
for ( i=1 i<n-1 i++)
{
for ( j=0 j< n-i-1 j++)
{
if ( a[j] < a[j+1])
{ temp=a[j]
a[j]=a[j+1]
a[j+1]=temp
}
}
}
for ( i=0 i<n i++)
{
if ( one < two ) one+=a[i]
else two+=a[i]
}
if(one >=two)
printf("%d",one-two)
else
printf("%d",two-one)
}