参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); print(input()); } public static String[] input(){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); // 吸收空格 sc.nextLine(); String[] st = new String[n]; for (int i = 0; i < n; i++) { String str = sc.nextLine(); st[i] = str.replaceAll(" ",",");; } return st; } public static void print(String[] st){ for (int i = 0; i < st.length; i++) { System.out.println(st[i]); } } }
0.0分
2 人评分
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:555 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:646 |
C语言训练-求PI* (C语言代码)(正确结果竟然是谜一样的3.141591)浏览:1301 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:625 |
C语言训练-尼科彻斯定理 (C语言代码)浏览:464 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:613 |
1157题解浏览:711 |
1113题解浏览:784 |
杨辉三角 (C语言代码)浏览:484 |
核桃的数量 (C语言代码)浏览:870 |