题解 | #字符圣诞树#

字符圣诞树

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();
        }
    }
}

全部评论

相关推荐

05-23 20:31
已编辑
武汉大学 Java
内向的柠檬精在研究求职打法:注意把武大标粗标大 本地你俩不是乱杀
点赞 评论 收藏
分享
评论
3
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务