Johnny with dotnet

m*n的棋盘上有多少矩型

 public static void Test(int m, int n)
        {
            
int count = 0;
            
for (int x = 0; x <= m - 1; x++)
            {
                
for (int y = 0; y <= n - 1; y++)
                {
                    
//x,y为左下顶点座标  
                    for (int i = x + 1; i <= m; i++)
                    {
                        
for (int j = y + 1; j <= n; j++)
                        {
                            
//i,j为矩形右上点座标  
                            count++;
                        }
                    }
                }
            }
            Console.WriteLine(count);
        }

 

posted on 2010-07-14 13:47  JohnnyNet  阅读(366)  评论(0编辑  收藏  举报

导航