解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static String[] input(){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
sc.nextLine();
String[] array = new String[N];
for(int i=0;i < N;i++){
String str = sc.nextLine();
str = str.replaceAll(" ", ",");
array[i] = str;
}
return array;
}
public static void print(String[] array){
for(int i=0;i<array.length;i++){
System.out.println(array[i]);
}
}
public static void main(String[] arg){
print(input());
}
}
0.0分
0 人评分
A+B for Input-Output Practice (VI) (C语言代码)浏览:547 |
C二级辅导-统计字符 (C语言代码)浏览:526 |
九宫重排 (C++代码)浏览:1319 |
A+B for Input-Output Practice (V) (C语言代码)浏览:617 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:515 |
C语言训练-大、小写问题 (C语言代码)浏览:604 |
简单的a+b (C语言代码)浏览:798 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:897 |
母牛的故事 (C语言代码)浏览:890 |
蓝桥杯历届试题-翻硬币 (C++代码)浏览:870 |
Fare丶梦 2017-08-22 10:03:37 |
这类似于Scanner sc = new Scnner(System.in); int n = sc.nextInt; String类型的输入方式有两种,,一种是next(),,,,一种是nextLine(),,,nextLine()会读取你输入回车前所有输入的数据(包括空格),,而next()不会读取空格后的回车内容