• 桃心代码


    Console.WriteLine("请问你需要多大的桃心:");
                int a = Convert.ToInt32(Console.ReadLine());
                if (a % 2 == 1) { a += 1; }
                int x = a / 2;
                for (int i = x / 2; i < a; i++)
                {
                    for (int j = 1; j < a; j++)
                    {
                        if (((i + j == x + 1 || j - i == x - 1) || (i == j || i + j == a)) && i > x / 2 && i <= x) { Console.Write((char)3+" "); }
                        else if (i - j == x - 1 || j + i == 3 * x - 1)
                        {
                            Console.Write((char)3 + " ");
                        }
                        else
                        {
                            Console.Write("  ");
                        }
                    }
                    Console.WriteLine();
                }

                Console.WriteLine("\n");

                int y = a / 4;
                for (int i = 1; i < a; i++)
                {
                    for (int j = 1; j < a; j++)
                    {
                        if (((j > y - i && j <= y + i - 1) || (j > 3 * y - i && j <= 3 * y + i - 1)) && i <= y + 1)
                        {
                            if (i == 1 && (j == y || j == 3 * y)) { Console.Write("  "); }
                            else { Console.Write((char)3 + " "); }
                        }
                        else if (i > y + 1 && (j < a - i + y + 6 && j > i - y - 6)) { Console.Write((char)3+" "); }

                        else { Console.Write("  "); }
                    }
                    Console.WriteLine();
                }

  • 相关阅读:
    MSBuild、条件编译、预处理命令
    批量数据插入SqlBulkCopy
    WPF 双向绑定
    编程思想之一
    python 提交表单
    python 添加用户
    python 分页
    day9 IO多路复用
    day9 线程、进程和协程深入版
    day8 进程、线程 简介版
  • 原文地址:https://www.cnblogs.com/wenmaoyu/p/2072199.html
Copyright © 2020-2023  润新知