Dumas


私信TA

用户名:lvanan

访问量:5225

签 名:

不爱学历,只爱学力。

等  级
排  名 2699
经  验 2069
参赛次数 0
文章发表 13
年  龄 0
在职情况 学生
学  校 河南农业大学
专  业

  自我简介:

解题思路:
核心代码部分是运用了字符串切割的方法,对于前N的输入数据而言,仅需在while语句框内直接输出即可。配合“\n”的换行操作解题即可。

注意事项:

参考代码:

package com.dotcpp;

import java.util.Scanner;

public class 字符串的输入输出 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		sc.nextLine();
		while(sc.hasNext()) {
			while(N-->0) {
				System.out.println(sc.nextLine()+"\n");
			}
			String s=sc.nextLine();
			String parr[]=s.split(" ");
			for(int i=0;i<parr.length;i++) {
				System.out.println(parr[i]+"\n");
			}
		}
	}
}


 

0.0分

0 人评分

  评论区