acDream


私信TA

用户名:acDream

访问量:31964

签 名:

欢迎光临CSDN博客https://blog.csdn.net/acDream_

等  级
排  名 137
经  验 7286
参赛次数 4
文章发表 72
年  龄 0
在职情况 学生
学  校 黑龙江工商学院
专  业 软件工程

  自我简介:

欢迎光临CSDN博客https://blog.csdn.net/acDream_

解题思路:

注意事项:

参考代码:

package cWeb.buleCup;

import java.util.Scanner;

public class C1094 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		in.nextLine();
		String [] strs = new String [N];
		for (int i = 0; i < strs.length; i++) {
			strs[i] = in.nextLine();
		}
		for (int i = 0; i < strs.length; i++) {
			System.out.println(strs[i]+"\n");
		}
		while(in.hasNext()) {
			String str = in.nextLine();
			int beginIndex = 0;
			int endIndex;
			for (int i = 0; i < str.length(); i++) {
				if(str.charAt(i)==' ') {
					endIndex = i;
					System.out.println(str.substring(beginIndex, endIndex)+"\n");
					beginIndex = i+1;
				}
				if(i==str.length()-1) {
					System.out.println(str.substring(beginIndex, str.length())+"\n");
				}
			}
		}
	}

}


 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区