offfffer:Scanner in = new Scanner(System.in);
String input = in.nextLine();
StringBuilder sb=new StringBuilder(input);
sb.deleteCharAt(0);
sb.deleteCharAt(sb.length()-1);
String[] strs=sb.toString().split(", ");
int[] a=new int[strs.length];
for (int i = 0; i < a.length; i++) {
a[i]=Integer.parseInt(strs[i].trim());
} 我是这么写的
0 点赞 评论 收藏
分享
关注他的用户也关注了: