解题思路:
注意事项:
参考代码:
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 人评分
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:525 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:458 |
九宫重排 (C++代码)浏览:2160 |
回文数(一) (C语言代码)浏览:728 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:577 |
DNA (C语言描述,数据结构)浏览:850 |
水仙花 (C语言代码)浏览:1045 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:984 |
简单的a+b (C语言代码)浏览:579 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:523 |