|
|
back to boardWA test#3 what is the problem?? Posted by sj alim 16 Jul 2018 02:36 #include<stdio.h> int main() { int n,i,j,item[9999],a,sum=0,temp; scanf("%d",&n); for(i=0; i<n; i++) scanf("%d",&item[i]); for(j=1; j<n; j++) for(a=n-1; a>=j; a--) { if(item[a-1]>item[a]) { temp=item[a-1]; item[a-1]=item[a]; item[a]=temp; } } for(i=0; i<((n+1)/2); i++) { sum=sum+(item[a]+1)/2; } printf("%d\n",sum); return 0; } |
|
|