Fork me on GitHub

牛客网编程练习之PAT乙级(Basic Level):1041 说反话

题目描述

 

直接分隔取反即可

 

AC代码:

import java.util.Scanner;

/**
 * @author CC11001100
 */
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		String[] ss = s.split("\\s+");
		for(int i=ss.length-1; i>=0; i--){
			System.out.print(ss[i] + (i>0 ? " " : ""));
		}

	}

}

 

 

题目来源: https://www.nowcoder.com/pat/2/problem/4075

 

.

posted @ 2017-12-10 23:33  CC11001100  阅读(287)  评论(0编辑  收藏  举报