题解 | #牛牛的字符菱形#

牛牛的字符菱形

https://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8

坐标轴
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String str = s.next();
        for (int x = -5 / 2; x <= 5 / 2; x++) {
            for (int y = -5 / 2; y <= 5 / 2; y++) {
                if ((x > 0 ? x : -x) + (y > 0 ? y : -y) <= 5 / 2) {
                    System.out.print(str);
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}
#猹的刷题生涯#
全部评论

相关推荐

2025-11-27 01:09
电子科技大学 C++
牛客68151836...:实习不相关就靠后写吧,因为大概面试官也不感兴趣。前面区域写一点更容易引起提问的内容,比如投后台就把服务器项目提前。
简历上的经历如何包装
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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