题目:输入一行数字,以空格隔开;再输入一个K,求上述字符串的第K大的数字
思路:接收数字到一个字符串,接收K
处理字符串到int数组
对数组冒泡排序
import java.util.Scanner;
public class findtheKmaxinaString {
public static void main(String[] args) throws Exception{
Scanner in = new Scanner (System.in);
int nums [] = new int[100];
int K = 0;
int t = 0;
int j = 0;
String str = in.nextLine();
String []snums = str.split(" ");
j = snums.length;
for(int i = 0 ; i < j; i++){
nums[i] = Integer.parseInt(snums[i]);
}
K = in.nextInt();
for(int p = 0; p