/**
 * @author 令照辉 [zeekling@163.com]
 * @version 1.0
 * @apiNote
 * @since 2018-06-27
 */
public class Program {

    /**
     *
     * @param arr 需要排序的数组
     */
    private static void mergeSort(int[] arr) {
        int[] tmp = new int[arr.length];
        internalMergeSort(arr, tmp, 0, arr.length - 1);
    }

    /**
     *
     * @param arr 需要排序的数组
     * @param tmp 暂时存放数据
     * @param left
     * @param right
     */
    private static void internalMergeSort(int[] arr, int[] tmp, int left, int right) {
        if (left < right) {
            int middle = (left + right) / 2;
            internalMergeSort(arr, tmp, left, middle);
            internalMergeSort(arr, tmp, middle + 1, right);
            mergeArray(arr, tmp, left, middle, right);
        }
    }

    /**
     *
     * @param arr
     * @param tmp
     * @param left
     * @param middle
     * @param right
     */
    private static void mergeArray(int[] arr, int[] tmp, int left, int middle, int right) {
        int i = left, j = middle + 1, k = 0;
        while (i <= middle && j <= right) {
            if (arr[i] <= arr[j]) {
                tmp[k++] = arr[i++];
            } else {
                tmp[k++] = arr[j++];
            }
        }
        while (i <= middle) tmp[k++] = arr[i++];
        while (j <= right) tmp[k++] = arr[j++];
        for (i = 0; i < k; i++)
            arr[left + i] = tmp[i];
    }


    /**
     * 输出格式：第11大的数，除前十个大数以外的所有数字的中位数
     * @param args
     */
    public static void main(String[] args) {
        if (args == null || args.length <= 10) return;
        int[] arr = new int[args.length];
        for (int i = 0;i<args.length;i++){
            arr[i] = Integer.valueOf(args[i]);
        }
        mergeSort(arr);
        int even = (10 + arr.length)%2;//判断是否为偶数
        if (even == 0){
            double add = arr[(10 + arr.length -1)/2] + arr[(10 + arr.length +1)/2];
            double middle = (add)/2;
            System.out.println(arr[10]+","+ middle);
        }else{
            int middle = arr[(10 + arr.length)/2];
            System.out.println(arr[10]+","+ middle);
        }

    }
}
