题解 | #学生基本信息输入输出#
学生基本信息输入输出
https://www.nowcoder.com/practice/58b6a69b4bf943b49d2cd3c15770b9fd
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String xh=scanner.nextLine();
String[] s=xh.split(";");
String[] s1=s[1].split(",");
System.out.printf("The each subject score of No. %d is %.2f, %.2f, %.2f.",Integer.parseInt(s[0]),Float.parseFloat(s1[0]),Float.parseFloat(s1[1]), Double.parseDouble(s1[2]));
}
}
查看10道真题和解析