Beispiel #1
0
        static void YangHui(int n)
        {
            MyQueue <int> qq = new MyQueue <int>(n + 1);

            Console.WriteLine(1);
            qq.InQueue(0);
            qq.InQueue(1);
            for (int i = 2; i <= n; i++)
            {
                qq.InQueue(0);
                int[] s = new int[i];
                for (int j = 0; j < i; j++)
                {
                    s[j] = qq.OutQueue() + qq.GetFirst();
                    Console.Write(s[j]);
                    Console.Write(' ');
                    qq.InQueue(s[j]);
                }
                Console.WriteLine();
            }
        }