解题思路:
注意事项:
参考代码:
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语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:529 |
简单的a+b (C语言代码)浏览:416 |
多组数据新方法浏览:355 |
C语言程序设计教程(第三版)课后习题9.1 (C语言代码)浏览:545 |
C语言程序设计教程(第三版)课后习题6.7 (C语言代码)浏览:513 |
1169题解浏览:525 |
C语言训练-阶乘和数* (也是笨办法,但是思路好理解),新手写的写的不好请见谅浏览:1477 |
母牛的故事 (C语言代码)浏览:757 |
危险系数 (C++代码)浏览:1213 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:643 |