|
|
back to boardwhy wrong answer # test case 5 Hello , Can someone please tell me why I am getting wrong answer for test case 5? I have used straight forward approach. ``` #include <stdio.h> 2 3 int group_distribution[10001]; 4 5 void insertion_sort( int * arr, int size) { 6 int i , j, key; 7 for ( i = 1; i < size; i ++ ) { 8 key = arr[i]; 9 j = i - 1; 10 while ( arr[j] > key && j >= 0 ) { 11 arr[j + 1] = arr[ j ]; 12 j = j - 1; 13 } 14 arr[ j + 1 ] = key; 15 } 16 } 17 18 int main( int argc, char **argv) { 19 int k, ans = 0, i ; 20 scanf("%d",&k); 21 for ( i = 0; i < k ; i ++) 22 scanf("%d",&group_distribution[i]); 23 insertion_sort(group_distribution, k); 24 for ( i = 0; i < (k+1)/2 ; i++ ) { 25 ans += (group_distribution[0]+1)/2 ; 26 } 27 printf("%d\n",ans); 28 return 0; 29 } ``` |
|
|