Blogwjl

 

输入示例

6
1,2,3,4,5,6

输出示例

 

1,2,3,4,5,6
1,2,3,4,5,6

 

 

 1 import java.util.Scanner;
 2 public class Demo01 {
 3     public static void main(String[] args) {
 4         Scanner sc = new Scanner(System.in);
 5         int n=sc.nextInt();
 6         String str = sc.next().toString();
 7         String[] arr = str.split(",");
 8         int[] b = new int[n];
 9         for (int j = 0; j < n; j++) {
10            b[j] = Integer.parseInt(arr[j]);
11             if(j!=n-1)
12             System.out.print(b[j] + ",");
13             else
14             System.out.println(b[j]);
15         }
16                 System.out.print(arr[0]);
17             for(int i=1;i<arr.length;i++){
18                 System.out.print(","+arr[i]);
19         }
sc.close();
20 } 21 }

 

分类:

技术点:

相关文章:

  • 2021-08-24
  • 2021-12-19
  • 2020-03-18
  • 2021-10-15
  • 2021-10-15
  • 2021-10-15
  • 2021-11-26
猜你喜欢
  • 2021-10-15
  • 2021-10-15
  • 2022-01-19
  • 2021-12-19
  • 2021-12-09
  • 2021-10-17
  • 2021-10-11
相关资源
相似解决方案