Esempio n. 1
0
 public static void FillRectangleWithNumeric(Graphics g, int x, int y, int w, int h, string text, string upperText)
 {
     g.FillRectangle(ComputingHelper.getRandomBrush(), x, y, w, h);
     g.DrawRectangle(Pens.Black, x, y, w, h);
     g.DrawString(text, SystemFonts.DefaultFont, Brushes.Black, x + w / 2, y + h / 2);
     g.DrawString(upperText, SystemFonts.DefaultFont, Brushes.Black, x, y);
 }
Esempio n. 2
0
        static int ans(int a, int b, int w, int h)
        {
            if (m[a, b] != -2)
            {
                ComputingHelper.Visualizate(g, a, b, w, h, m[a, b]);
            }
            if (m[a, b] >= 0)
            {
                return(m[a, b]);
            }

            m[a, b] = a * b + 1;
            for (int dx = 1; dx <= a / 2; dx++)
            {
                m[a, b] = Math.Min(m[a, b], ans(dx, b, w, h) + ans(a - dx, b, w + dx, h));
            }
            for (int dy = 1; dy <= b / 2; dy++)
            {
                m[a, b] = Math.Min(m[a, b], ans(a, dy, w, h) + ans(a, b - dy, w, h + dy));
            }
            return(m[a, b]);
        }