[恢]hdu 2535

2011-12-15 03:38:08

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2535

题意:中文~

mark:坑爹。wa了。是超过一半,不是超过或等于一半。

代码:

# include <stdio.h>
# include <stdlib.h>


int cmp(const void *a, const void *b)
{
return *(int*)a - *(int*) b ;
}


int main ()
{
int n, i, sum ;
int a[110] ;
while (~scanf ("%d", &n) && n)
{
for (i = 0 ; i < n ; i++)
scanf ("%d", a+i) ;
qsort (a, n, 4, cmp) ;
sum = 0 ;
for (i = 0 ; i < (n/2 + 1) ; i++)
sum += a[i]/2 + 1;
printf ("%d\n", sum) ;
}

return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2314652.html