题解 | #字符圣诞树#
字符圣诞树
http://www.nowcoder.com/practice/0fae60c3b5c64699b7c0f031c2187dde
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); int len = 5; for(int i=1;i<=len;i++){ for(int j=len-i;j>=1;j--){ System.out.print(" "); } for(int k=1;k<=i;k++){ System.out.print(s + " "); } System.out.println(); } } }