解题思路:
注意事项:
参考代码:
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语言程序设计教程(第三版)课后习题5.7 (C++代码)浏览:598 |
C二级辅导-阶乘数列 (C语言代码)浏览:827 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:580 |
母牛的故事 (C语言代码)浏览:738 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:635 |
C二级辅导-同因查找 (C语言代码)浏览:660 |
2006年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:805 |
用筛法求之N内的素数。 (C语言代码)浏览:1232 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:594 |
用筛法求之N内的素数。 (C++代码)浏览:692 |