zoukankan      html  css  js  c++  java
  • 桃心代码

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

  • 相关阅读:
    socket的使用一
    logging模块
    configparser模块
    python中read() readline()以及readlines()用法
    hashlib
    JavaScript中forEach的用法相关
    循环调用是事件绑定中遇到的一些问题
    javascript 中 offsetWidth,clientWidth;offsetHeight,clientHeight的区别
    javascript事件:获取事件对象getEvent函数
    html标签之meta标签
  • 原文地址:https://www.cnblogs.com/wenmaoyu/p/2072199.html
Copyright © 2011-2022 走看看