题解 | #翻转金字塔图案#
翻转金字塔图案
http://www.nowcoder.com/practice/c4775776e4464537bfb6a5ba37c596c6
import java.util.Scanner;
import java.util.Collections;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while(scan.hasNextInt()) {
int num = scan.nextInt();
for(int i = 0; i < num; i++) {
System.out.println(String.join("", Collections.nCopies(i, " ")) +
String.join("", Collections.nCopies(num - i, "* ")));
}
}
}
}