下面是我的java写的快排,过不了。。。```java import java.math.; import java.util.; import java.io.*;
public class Main {
public static void q_Sort(int[] book, int left, int right, int k) {
if(right <= left)
return;
int head = left;
int tail = right;
int num = book[head];
int m = head;
while(head < tail) {
while(tail > head && book[tail] > num)
tail--;
book[m] = book[tail];
m = tail;
while(head < tail && book[head] < num)
head++;
book[m] = book[head];
m = head;
}
book[m] = num;
if(m > k)
q_Sort(book, left, m-1, k);
else if(m < k)
q_Sort(book, m+1, right, k);
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] book = new int[n];
for(int i=0; i<n; i++)
book[i] = in.nextInt();
q_Sort(book, 0, n-1, k);
System.out.println(book[k]);
}
}
我调用库函数Arrays.sort(book)也过不了,只能拿60分。想问问怎么搞啊