解题思路:
注意事项: 注意scanner缓存区
参考代码:import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int i = scanner.nextInt();
scanner.nextLine();
while(scanner.hasNext()){
if(i>0){
String s = scanner.nextLine();
System.out.println(s);
System.out.println();
i--;
}
else{
String s = scanner.nextLine();
for (int j = 0; j < s.split(" ").length; j++) {
System.out.println(s.split(" ")[j]);
System.out.println();
}
}
}
}
}
0.0分
0 人评分